Rev 1880 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1 | ingob | 1 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1338 | ingob | 2 | // + Copyright (c) Holger Buss, Ingo Busker |
1 | ingob | 3 | // + only for non-profit use |
4 | // + www.MikroKopter.com |
||
5 | // + see the File "License.txt" for further Informations |
||
6 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
||
1051 | killagreg | 7 | #include <stdarg.h> |
8 | #include <string.h> |
||
1490 | killagreg | 9 | #include <avr/pgmspace.h> |
1 | ingob | 10 | #include "main.h" |
11 | #include "uart.h" |
||
1438 | ingob | 12 | #include "libfc.h" |
1622 | killagreg | 13 | #include "eeprom.h" |
1 | ingob | 14 | |
1054 | killagreg | 15 | #define FC_ADDRESS 1 |
16 | #define NC_ADDRESS 2 |
||
17 | #define MK3MAG_ADDRESS 3 |
||
1622 | killagreg | 18 | #define BL_CTRL_ADDRESS 5 |
1054 | killagreg | 19 | |
1415 | killagreg | 20 | #define ABO_TIMEOUT 4000 // disable abo after 4 seconds |
1760 | holgerb | 21 | #define MAX_SENDE_BUFF 170 |
22 | #define MAX_EMPFANGS_BUFF 170 |
||
1657 | killagreg | 23 | |
24 | #define BLPARAM_REVISION 1 |
||
25 | #define MASK_SET_PWM_SCALING 0x01 |
||
26 | #define MASK_SET_CURRENT_LIMIT 0x02 |
||
27 | #define MASK_SET_TEMP_LIMIT 0x04 |
||
28 | #define MASK_SET_CURRENT_SCALING 0x08 |
||
29 | #define MASK_SET_BITCONFIG 0x10 |
||
30 | #define MASK_RESET_CAPCOUNTER 0x20 |
||
31 | #define MASK_SET_DEFAULT_PARAMS 0x40 |
||
32 | #define MASK_SET_SAVE_EEPROM 0x80 |
||
33 | |||
34 | typedef struct |
||
35 | { |
||
36 | unsigned char Revision; // revision of parameter structure |
||
37 | unsigned char Address; // target address |
||
38 | unsigned char PwmScaling; // maximum value of pwm setpoint |
||
39 | unsigned char CurrentLimit; // current limit in 1A steps |
||
40 | unsigned char TemperatureLimit; // in °C |
||
41 | unsigned char CurrentScaling; // scaling factor for current measurement |
||
42 | unsigned char BitConfig; // see defines above |
||
43 | unsigned char SetMask; // filter for active paramters |
||
44 | unsigned char Checksum; // checksum for parameter sturcture |
||
45 | } __attribute__((packed)) BLParameter_t; |
||
46 | |||
47 | |||
1053 | killagreg | 48 | unsigned char GetExternalControl = 0,DebugDisplayAnforderung1 = 0, DebugDisplayAnforderung = 0,DebugDataAnforderung = 0,GetVersionAnforderung = 0, GetPPMChannelAnforderung = 0; |
49 | unsigned char DisplayLine = 0; |
||
1 | ingob | 50 | unsigned volatile char SioTmp = 0; |
51 | unsigned volatile char NeuerDatensatzEmpfangen = 0; |
||
52 | unsigned volatile char NeueKoordinateEmpfangen = 0; |
||
53 | unsigned volatile char UebertragungAbgeschlossen = 1; |
||
54 | unsigned volatile char CntCrcError = 0; |
||
55 | unsigned volatile char AnzahlEmpfangsBytes = 0; |
||
1441 | ingob | 56 | unsigned volatile char TxdBuffer[MAX_SENDE_BUFF]; |
57 | unsigned volatile char RxdBuffer[MAX_EMPFANGS_BUFF]; |
||
58 | |||
1051 | killagreg | 59 | unsigned char *pRxData = 0; |
60 | unsigned char RxDataLen = 0; |
||
1 | ingob | 61 | unsigned volatile char PC_DebugTimeout = 0; |
1212 | hbuss | 62 | unsigned volatile char PC_MotortestActive = 0; |
1636 | ingob | 63 | unsigned char DebugTextAnforderung = 255; |
1051 | killagreg | 64 | |
1 | ingob | 65 | unsigned char PcZugriff = 100; |
1212 | hbuss | 66 | unsigned char MotorTest[16]; |
1036 | hbuss | 67 | unsigned char MeineSlaveAdresse = 1; // Flight-Ctrl |
595 | hbuss | 68 | unsigned char ConfirmFrame; |
1 | ingob | 69 | struct str_DebugOut DebugOut; |
595 | hbuss | 70 | struct str_ExternControl ExternControl; |
1 | ingob | 71 | struct str_VersionInfo VersionInfo; |
693 | hbuss | 72 | struct str_WinkelOut WinkelOut; |
1171 | hbuss | 73 | struct str_Data3D Data3D; |
1 | ingob | 74 | |
1399 | killagreg | 75 | int Display_Timer, Debug_Timer,Kompass_Timer,Timer3D; |
1415 | killagreg | 76 | unsigned int DebugDataIntervall = 0, Intervall3D = 0, Display_Interval = 0; |
77 | unsigned int AboTimeOut = 0; |
||
1777 | ingob | 78 | unsigned volatile char JetiUpdateModeActive = 0; |
693 | hbuss | 79 | |
1897 | - | 80 | |
81 | |||
82 | |||
83 | |||
84 | #ifdef WITH_FULL_ANALOG_TEXT /// MartinW main.h means no memsave |
||
85 | #warning : "### with normal ANALOG_TEXT[32][16] ###" |
||
86 | |||
1490 | killagreg | 87 | const unsigned char ANALOG_TEXT[32][16] PROGMEM = |
499 | hbuss | 88 | { |
1051 | killagreg | 89 | //1234567890123456 |
1175 | hbuss | 90 | "AngleNick ", //0 |
91 | "AngleRoll ", |
||
1051 | killagreg | 92 | "AccNick ", |
499 | hbuss | 93 | "AccRoll ", |
1523 | holgerb | 94 | "YawGyro ", |
1521 | killagreg | 95 | "Height Value ", //5 |
499 | hbuss | 96 | "AccZ ", |
97 | "Gas ", |
||
1175 | hbuss | 98 | "Compass Value ", |
1528 | holgerb | 99 | "Voltage [0.1V] ", |
1521 | killagreg | 100 | "Receiver Level ", //10 |
101 | "Gyro Compass ", |
||
102 | "Motor 1 ", |
||
103 | "Motor 2 ", |
||
104 | "Motor 3 ", |
||
105 | "Motor 4 ", //15 |
||
1897 | - | 106 | "Motor 5 ",/// |
107 | "Motor 6 ",/// |
||
108 | "nc alt speed ", |
||
1865 | holgerb | 109 | "19 ", |
854 | hbuss | 110 | "Servo ", //20 |
1521 | killagreg | 111 | "Hovergas ", |
1523 | holgerb | 112 | "Current [0.1A] ", |
1501 | holgerb | 113 | "Capacity [mAh] ", |
1879 | holgerb | 114 | "Hight Setpoint ", |
1897 | - | 115 | "Motor 7 ", //25 /// |
116 | "Motor 8 ",/// |
||
1839 | holgerb | 117 | "Compass Setpoint", |
1322 | hbuss | 118 | "I2C-Error ", |
1761 | killagreg | 119 | "BL Limit ", |
720 | ingob | 120 | "GPS_Nick ", //30 |
121 | "GPS_Roll " |
||
1897 | - | 122 | }; |
1871 | holgerb | 123 | |
1897 | - | 124 | #else |
125 | #warning : "### with reduced ANALOG_TEXT[32][13] ###" |
||
126 | const unsigned char ANALOG_TEXT[32][13] PROGMEM = |
||
127 | { |
||
128 | //1234567890123456 |
||
129 | "AngleNick ", //0 |
||
130 | "AngleRoll ", |
||
131 | "AccNick ", |
||
132 | "AccRoll ", |
||
133 | "YawGyro ", |
||
134 | "Height Value ", //5 |
||
135 | "AccZ ", |
||
136 | "Gas ", |
||
137 | "Compass Value", |
||
138 | "Voltage[0.1V]", |
||
139 | "ReceiverLevel", //10 |
||
140 | "Gyro Compass ", |
||
141 | "Motor 1 ", |
||
142 | "Motor 2 ", |
||
143 | "Motor 3 ", |
||
144 | "Motor 4 ", //15 |
||
145 | "Motor 5 ",/// |
||
146 | "Motor 6 ",/// |
||
147 | "nc alt speed ", |
||
148 | "19 ", |
||
149 | "Servo ", //20 |
||
150 | "Hovergas ", |
||
151 | "Current[0.1A]", |
||
152 | "Capacity[mAh]", |
||
153 | "Hight Setp ", |
||
154 | "Motor 8 ", //25 /// |
||
155 | "Motor 9 ",/// |
||
156 | "Compass Setp ", |
||
157 | "I2C-Error ", |
||
158 | "BL Limit ", |
||
159 | "GPS_Nick ", //30 |
||
160 | "GPS_Roll " |
||
161 | }; |
||
162 | |||
163 | |||
164 | #endif |
||
165 | |||
1 | ingob | 166 | //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
167 | //++ Sende-Part der Datenübertragung |
||
168 | //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
||
1561 | killagreg | 169 | ISR(USART0_TX_vect) |
1 | ingob | 170 | { |
171 | static unsigned int ptr = 0; |
||
172 | unsigned char tmp_tx; |
||
1783 | killagreg | 173 | |
174 | if(!UebertragungAbgeschlossen) |
||
1 | ingob | 175 | { |
176 | ptr++; // die [0] wurde schon gesendet |
||
1438 | ingob | 177 | tmp_tx = TxdBuffer[ptr]; |
1 | ingob | 178 | if((tmp_tx == '\r') || (ptr == MAX_SENDE_BUFF)) |
179 | { |
||
180 | ptr = 0; |
||
181 | UebertragungAbgeschlossen = 1; |
||
182 | } |
||
1561 | killagreg | 183 | UDR0 = tmp_tx; |
1051 | killagreg | 184 | } |
1 | ingob | 185 | else ptr = 0; |
186 | } |
||
187 | |||
188 | //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
||
189 | //++ Empfangs-Part der Datenübertragung, incl. CRC-Auswertung |
||
190 | //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
||
1561 | killagreg | 191 | ISR(USART0_RX_vect) |
1 | ingob | 192 | { |
193 | static unsigned int crc; |
||
194 | static unsigned char crc1,crc2,buf_ptr; |
||
195 | static unsigned char UartState = 0; |
||
196 | unsigned char CrcOkay = 0; |
||
197 | |||
1782 | ingob | 198 | if (JetiUpdateModeActive == 1) { UDR1 = UDR0; return; } |
199 | if (JetiUpdateModeActive == 2) { RxdBuffer[0] = UDR0; return; } |
||
1783 | killagreg | 200 | |
1561 | killagreg | 201 | SioTmp = UDR0; |
1783 | killagreg | 202 | |
1438 | ingob | 203 | if(buf_ptr >= MAX_SENDE_BUFF) UartState = 0; |
1051 | killagreg | 204 | if(SioTmp == '\r' && UartState == 2) |
1 | ingob | 205 | { |
206 | UartState = 0; |
||
207 | crc -= RxdBuffer[buf_ptr-2]; |
||
208 | crc -= RxdBuffer[buf_ptr-1]; |
||
209 | crc %= 4096; |
||
210 | crc1 = '=' + crc / 64; |
||
211 | crc2 = '=' + crc % 64; |
||
212 | CrcOkay = 0; |
||
213 | if((crc1 == RxdBuffer[buf_ptr-2]) && (crc2 == RxdBuffer[buf_ptr-1])) CrcOkay = 1; else { CrcOkay = 0; CntCrcError++;}; |
||
214 | if(!NeuerDatensatzEmpfangen && CrcOkay) // Datensatz schon verarbeitet |
||
215 | { |
||
1051 | killagreg | 216 | NeuerDatensatzEmpfangen = 1; |
217 | AnzahlEmpfangsBytes = buf_ptr + 1; |
||
1 | ingob | 218 | RxdBuffer[buf_ptr] = '\r'; |
1253 | killagreg | 219 | if(RxdBuffer[2] == 'R') |
1232 | hbuss | 220 | { |
1897 | - | 221 | |
222 | #ifdef WITH_MKTOOL_Display /// MartinW main.h |
||
223 | #warning : "### with MKTool Display ###" |
||
1435 | killagreg | 224 | LcdClear(); |
1897 | - | 225 | #endif |
226 | |||
1232 | hbuss | 227 | wdt_enable(WDTO_250MS); // Reset-Commando |
228 | ServoActive = 0; |
||
1253 | killagreg | 229 | } |
1783 | killagreg | 230 | |
1051 | killagreg | 231 | } |
1 | ingob | 232 | } |
233 | else |
||
234 | switch(UartState) |
||
235 | { |
||
236 | case 0: |
||
237 | if(SioTmp == '#' && !NeuerDatensatzEmpfangen) UartState = 1; // Startzeichen und Daten schon verarbeitet |
||
238 | buf_ptr = 0; |
||
239 | RxdBuffer[buf_ptr++] = SioTmp; |
||
240 | crc = SioTmp; |
||
241 | break; |
||
242 | case 1: // Adresse auswerten |
||
243 | UartState++; |
||
244 | RxdBuffer[buf_ptr++] = SioTmp; |
||
245 | crc += SioTmp; |
||
246 | break; |
||
247 | case 2: // Eingangsdaten sammeln |
||
248 | RxdBuffer[buf_ptr] = SioTmp; |
||
1490 | killagreg | 249 | if(buf_ptr < MAX_EMPFANGS_BUFF) buf_ptr++; |
1 | ingob | 250 | else UartState = 0; |
251 | crc += SioTmp; |
||
252 | break; |
||
1051 | killagreg | 253 | default: |
254 | UartState = 0; |
||
1 | ingob | 255 | break; |
256 | } |
||
257 | } |
||
258 | |||
259 | |||
260 | // -------------------------------------------------------------------------- |
||
261 | void AddCRC(unsigned int wieviele) |
||
262 | { |
||
1051 | killagreg | 263 | unsigned int tmpCRC = 0,i; |
1 | ingob | 264 | for(i = 0; i < wieviele;i++) |
265 | { |
||
1438 | ingob | 266 | tmpCRC += TxdBuffer[i]; |
1 | ingob | 267 | } |
268 | tmpCRC %= 4096; |
||
1438 | ingob | 269 | TxdBuffer[i++] = '=' + tmpCRC / 64; |
270 | TxdBuffer[i++] = '=' + tmpCRC % 64; |
||
271 | TxdBuffer[i++] = '\r'; |
||
1 | ingob | 272 | UebertragungAbgeschlossen = 0; |
1561 | killagreg | 273 | UDR0 = TxdBuffer[0]; |
1 | ingob | 274 | } |
275 | |||
276 | |||
277 | |||
278 | // -------------------------------------------------------------------------- |
||
1056 | killagreg | 279 | void SendOutData(unsigned char cmd,unsigned char address, unsigned char BufferAnzahl, ...) //unsigned char *snd, unsigned char len) |
1 | ingob | 280 | { |
1051 | killagreg | 281 | va_list ap; |
1 | ingob | 282 | unsigned int pt = 0; |
283 | unsigned char a,b,c; |
||
284 | unsigned char ptr = 0; |
||
285 | |||
1051 | killagreg | 286 | unsigned char *snd = 0; |
287 | int len = 0; |
||
288 | |||
1438 | ingob | 289 | TxdBuffer[pt++] = '#'; // Startzeichen |
290 | TxdBuffer[pt++] = 'a' + address; // Adresse (a=0; b=1,...) |
||
291 | TxdBuffer[pt++] = cmd; // Commando |
||
1 | ingob | 292 | |
1051 | killagreg | 293 | va_start(ap, BufferAnzahl); |
294 | if(BufferAnzahl) |
||
295 | { |
||
296 | snd = va_arg(ap, unsigned char*); |
||
297 | len = va_arg(ap, int); |
||
298 | ptr = 0; |
||
299 | BufferAnzahl--; |
||
300 | } |
||
1 | ingob | 301 | while(len) |
302 | { |
||
1051 | killagreg | 303 | if(len) |
304 | { |
||
305 | a = snd[ptr++]; |
||
306 | len--; |
||
307 | if((!len) && BufferAnzahl) |
||
308 | { |
||
309 | snd = va_arg(ap, unsigned char*); |
||
310 | len = va_arg(ap, int); |
||
311 | ptr = 0; |
||
312 | BufferAnzahl--; |
||
313 | } |
||
314 | } |
||
315 | else a = 0; |
||
316 | if(len) |
||
317 | { |
||
318 | b = snd[ptr++]; |
||
319 | len--; |
||
320 | if((!len) && BufferAnzahl) |
||
321 | { |
||
322 | snd = va_arg(ap, unsigned char*); |
||
323 | len = va_arg(ap, int); |
||
324 | ptr = 0; |
||
325 | BufferAnzahl--; |
||
326 | } |
||
327 | } |
||
328 | else b = 0; |
||
329 | if(len) |
||
330 | { |
||
331 | c = snd[ptr++]; |
||
332 | len--; |
||
333 | if((!len) && BufferAnzahl) |
||
334 | { |
||
335 | snd = va_arg(ap, unsigned char*); |
||
336 | len = va_arg(ap, int); |
||
337 | ptr = 0; |
||
338 | BufferAnzahl--; |
||
339 | } |
||
340 | } |
||
341 | else c = 0; |
||
1438 | ingob | 342 | TxdBuffer[pt++] = '=' + (a >> 2); |
343 | TxdBuffer[pt++] = '=' + (((a & 0x03) << 4) | ((b & 0xf0) >> 4)); |
||
344 | TxdBuffer[pt++] = '=' + (((b & 0x0f) << 2) | ((c & 0xc0) >> 6)); |
||
345 | TxdBuffer[pt++] = '=' + ( c & 0x3f); |
||
1 | ingob | 346 | } |
1051 | killagreg | 347 | va_end(ap); |
1 | ingob | 348 | AddCRC(pt); |
349 | } |
||
350 | |||
351 | // -------------------------------------------------------------------------- |
||
1051 | killagreg | 352 | void Decode64(void) // die daten werden im rx buffer dekodiert, das geht nur, weil aus 4 byte immer 3 gemacht werden. |
1 | ingob | 353 | { |
354 | unsigned char a,b,c,d; |
||
355 | unsigned char x,y,z; |
||
1051 | killagreg | 356 | unsigned char ptrIn = 3; // start at begin of data block |
357 | unsigned char ptrOut = 3; |
||
358 | unsigned char len = AnzahlEmpfangsBytes - 6; // von der Gesamtbytezahl eines Frames gehen 3 Bytes des Headers ('#',Addr, Cmd) und 3 Bytes des Footers (CRC1, CRC2, '\r') ab. |
||
359 | |||
1 | ingob | 360 | while(len) |
361 | { |
||
362 | a = RxdBuffer[ptrIn++] - '='; |
||
363 | b = RxdBuffer[ptrIn++] - '='; |
||
364 | c = RxdBuffer[ptrIn++] - '='; |
||
365 | d = RxdBuffer[ptrIn++] - '='; |
||
366 | |||
367 | x = (a << 2) | (b >> 4); |
||
368 | y = ((b & 0x0f) << 4) | (c >> 2); |
||
369 | z = ((c & 0x03) << 6) | d; |
||
370 | |||
1051 | killagreg | 371 | if(len--) RxdBuffer[ptrOut++] = x; else break; |
372 | if(len--) RxdBuffer[ptrOut++] = y; else break; |
||
373 | if(len--) RxdBuffer[ptrOut++] = z; else break; |
||
1 | ingob | 374 | } |
1051 | killagreg | 375 | pRxData = (unsigned char*)&RxdBuffer[3]; // decodierte Daten beginnen beim 4. Byte |
376 | RxDataLen = ptrOut - 3; // wie viele Bytes wurden dekodiert? |
||
1 | ingob | 377 | |
378 | } |
||
379 | |||
380 | // -------------------------------------------------------------------------- |
||
381 | void BearbeiteRxDaten(void) |
||
382 | { |
||
383 | if(!NeuerDatensatzEmpfangen) return; |
||
384 | |||
1665 | killagreg | 385 | unsigned char tempchar1, tempchar2; |
1056 | killagreg | 386 | Decode64(); // dekodiere datenblock im Empfangsbuffer |
1055 | ingob | 387 | switch(RxdBuffer[1]-'a') // check for Slave Address |
1054 | killagreg | 388 | { |
389 | case FC_ADDRESS: // FC special commands |
||
390 | switch(RxdBuffer[2]) |
||
391 | { |
||
392 | case 'K':// Kompasswert |
||
393 | memcpy((unsigned char *)&KompassValue , (unsigned char *)pRxData, sizeof(KompassValue)); |
||
1837 | holgerb | 394 | KompassRichtung = ((540 + KompassValue - KompassSollWert) % 360) - 180; |
1054 | killagreg | 395 | break; |
396 | case 't':// Motortest |
||
1212 | hbuss | 397 | if(AnzahlEmpfangsBytes > 20) memcpy(&MotorTest[0], (unsigned char *)pRxData, sizeof(MotorTest)); |
398 | else memcpy(&MotorTest[0], (unsigned char *)pRxData, 4); |
||
399 | PC_MotortestActive = 240; |
||
1065 | killagreg | 400 | //while(!UebertragungAbgeschlossen); |
401 | //SendOutData('T', MeineSlaveAdresse, 0); |
||
1054 | killagreg | 402 | PcZugriff = 255; |
403 | break; |
||
1053 | killagreg | 404 | |
1209 | hbuss | 405 | case 'n':// "Get Mixer |
406 | while(!UebertragungAbgeschlossen); |
||
1622 | killagreg | 407 | SendOutData('N', FC_ADDRESS, 1, (unsigned char *) &Mixer, sizeof(Mixer) - 1); |
1636 | ingob | 408 | Debug("Mixer lesen"); |
1209 | hbuss | 409 | break; |
410 | |||
411 | case 'm':// "Write Mixer |
||
1622 | killagreg | 412 | if(pRxData[0] == EEMIXER_REVISION) |
1521 | killagreg | 413 | { |
1622 | killagreg | 414 | memcpy(&Mixer, (unsigned char *)pRxData, sizeof(Mixer) - 1); |
415 | MixerTable_WriteToEEProm(); |
||
1211 | hbuss | 416 | tempchar1 = 1; |
1765 | killagreg | 417 | VersionInfo.HardwareError[1] &= ~FC_ERROR1_MIXER; |
1521 | killagreg | 418 | } |
1622 | killagreg | 419 | else |
420 | { |
||
421 | tempchar1 = 0; |
||
422 | } |
||
423 | while(!UebertragungAbgeschlossen); |
||
1211 | hbuss | 424 | SendOutData('M', FC_ADDRESS, 1, &tempchar1, sizeof(tempchar1)); |
1209 | hbuss | 425 | break; |
426 | |||
1054 | killagreg | 427 | case 'p': // get PPM Channels |
428 | GetPPMChannelAnforderung = 1; |
||
1377 | hbuss | 429 | PcZugriff = 255; |
1054 | killagreg | 430 | break; |
1053 | killagreg | 431 | |
1054 | killagreg | 432 | case 'q':// "Get"-Anforderung für Settings |
433 | // Bei Get werden die vom PC einstellbaren Werte vom PC zurückgelesen |
||
1761 | killagreg | 434 | if((10 <= pRxData[0]) && (pRxData[0] < 20)) |
1054 | killagreg | 435 | { |
1761 | killagreg | 436 | tempchar1 = pRxData[0] - 10; |
437 | if(tempchar1< 1) tempchar1 = 1; // limit to 1 |
||
438 | else if(tempchar1 > 5) tempchar1 = 5; // limit to 5 |
||
439 | SetDefaultParameter(tempchar1, 1); |
||
1054 | killagreg | 440 | } |
1761 | killagreg | 441 | else if((20 <= pRxData[0]) && (pRxData[0] < 30)) |
442 | { |
||
443 | tempchar1 = pRxData[0] - 20; |
||
444 | if(tempchar1< 1) tempchar1 = 1; // limit to 1 |
||
445 | else if(tempchar1 > 5) tempchar1 = 5; // limit to 5 |
||
446 | SetDefaultParameter(tempchar1, 0); |
||
447 | } |
||
448 | else |
||
449 | { |
||
450 | tempchar1 = pRxData[0]; |
||
451 | if(tempchar1 == 0xFF) |
||
452 | { |
||
453 | tempchar1 = GetActiveParamSet(); |
||
454 | } |
||
455 | if(tempchar1< 1) tempchar1 = 1; // limit to 1 |
||
456 | else if(tempchar1 > 5) tempchar1 = 5; // limit to 5 |
||
457 | // load requested parameter set |
||
458 | ParamSet_ReadFromEEProm(tempchar1); |
||
459 | } |
||
1054 | killagreg | 460 | while(!UebertragungAbgeschlossen); |
1622 | killagreg | 461 | SendOutData('Q', FC_ADDRESS, 2, &tempchar1, sizeof(tempchar1), (unsigned char *) &EE_Parameter, sizeof(EE_Parameter) - 1); |
1636 | ingob | 462 | Debug("Lese Setting %d", tempchar1); |
1654 | killagreg | 463 | |
1054 | killagreg | 464 | break; |
1051 | killagreg | 465 | |
1054 | killagreg | 466 | case 's': // Parametersatz speichern |
1862 | holgerb | 467 | if((1 <= pRxData[0]) && (pRxData[0] <= 5) && (pRxData[1] == EEPARAM_REVISION) && MotorenEin == 0) // check for setting to be in range |
1054 | killagreg | 468 | { |
1622 | killagreg | 469 | memcpy(&EE_Parameter, (uint8_t*)&pRxData[1], sizeof(EE_Parameter) - 1); |
470 | ParamSet_WriteToEEProm(pRxData[0]); |
||
1054 | killagreg | 471 | Umschlag180Nick = (long) EE_Parameter.WinkelUmschlagNick * 2500L; |
472 | Umschlag180Roll = (long) EE_Parameter.WinkelUmschlagRoll * 2500L; |
||
1622 | killagreg | 473 | tempchar1 = GetActiveParamSet(); |
1054 | killagreg | 474 | } |
1058 | killagreg | 475 | else |
476 | { |
||
477 | tempchar1 = 0; // mark in response an invlid setting |
||
478 | } |
||
479 | while(!UebertragungAbgeschlossen); |
||
480 | SendOutData('S', FC_ADDRESS, 1, &tempchar1, sizeof(tempchar1)); |
||
1405 | hbuss | 481 | if(!MotorenEin) Piep(tempchar1,110); |
482 | LipoDetection(0); |
||
1626 | killagreg | 483 | LIBFC_ReceiverInit(EE_Parameter.Receiver); |
1054 | killagreg | 484 | break; |
1405 | hbuss | 485 | case 'f': // auf anderen Parametersatz umschalten |
1622 | killagreg | 486 | if((1 <= pRxData[0]) && (pRxData[0] <= 5)) ParamSet_ReadFromEEProm(pRxData[0]); |
487 | tempchar1 = GetActiveParamSet(); |
||
1405 | hbuss | 488 | while(!UebertragungAbgeschlossen); |
489 | SendOutData('F', FC_ADDRESS, 1, &tempchar1, sizeof(tempchar1)); |
||
490 | if(!MotorenEin) Piep(tempchar1,110); |
||
491 | LipoDetection(0); |
||
1626 | killagreg | 492 | LIBFC_ReceiverInit(EE_Parameter.Receiver); |
1405 | hbuss | 493 | break; |
1391 | killagreg | 494 | case 'y':// serial Potis |
495 | PPM_in[13] = (signed char) pRxData[0]; PPM_in[14] = (signed char) pRxData[1]; PPM_in[15] = (signed char) pRxData[2]; PPM_in[16] = (signed char) pRxData[3]; |
||
496 | PPM_in[17] = (signed char) pRxData[4]; PPM_in[18] = (signed char) pRxData[5]; PPM_in[19] = (signed char) pRxData[6]; PPM_in[20] = (signed char) pRxData[7]; |
||
497 | PPM_in[21] = (signed char) pRxData[8]; PPM_in[22] = (signed char) pRxData[9]; PPM_in[23] = (signed char) pRxData[10]; PPM_in[24] = (signed char) pRxData[11]; |
||
498 | break; |
||
499 | |||
1662 | killagreg | 500 | case 'u': // request BL parameter |
501 | Debug("Reading BL %d", pRxData[0]); |
||
502 | // try to read BL configuration |
||
1665 | killagreg | 503 | tempchar2 = I2C_ReadBLConfig(pRxData[0]); |
1673 | killagreg | 504 | if(tempchar2 == BLCONFIG_SUCCESS) tempchar1 = 1; |
505 | else tempchar1 = 0; |
||
506 | while(!UebertragungAbgeschlossen); // wait for previous frame to be sent |
||
1674 | ingob | 507 | SendOutData('U', FC_ADDRESS, 4, &tempchar1, sizeof(tempchar1), &tempchar2, sizeof(tempchar2), &pRxData[0], 1, &BLConfig, sizeof(BLConfig_t)); |
1662 | killagreg | 508 | break; |
509 | |||
510 | case 'w': // write BL parameter |
||
511 | Debug("Writing BL %d", pRxData[0]); |
||
512 | if(RxDataLen >= 1+sizeof(BLConfig_t)) |
||
513 | { |
||
514 | memcpy(&BLConfig, (uint8_t*)(&pRxData[1]), sizeof(BLConfig_t)); |
||
1665 | killagreg | 515 | tempchar2 = I2C_WriteBLConfig(pRxData[0]); |
516 | if(tempchar2 == BLCONFIG_SUCCESS) tempchar1 = 1; |
||
517 | else tempchar1 = 0; // indicate error |
||
1662 | killagreg | 518 | while(!UebertragungAbgeschlossen); // wait for previous frame to be sent |
1665 | killagreg | 519 | SendOutData('W', FC_ADDRESS,2, &tempchar1, sizeof(tempchar1), &tempchar2, sizeof(tempchar2)); |
1662 | killagreg | 520 | } |
521 | break; |
||
1783 | killagreg | 522 | case 'j': |
1897 | - | 523 | |
524 | |||
525 | #ifdef WITH_JETI_SIMULATION /// MartinW main.h means no memsave |
||
526 | #warning : "### with jeti update command ###" |
||
527 | |||
528 | |||
529 | |||
1783 | killagreg | 530 | tempchar1 = LIBFC_GetCPUType(); |
531 | if((tempchar1 == CPU_ATMEGA644P) || (tempchar1 == CPU_ATMEGA1284P)) |
||
1782 | ingob | 532 | { |
1783 | killagreg | 533 | uint16_t ubrr = (uint16_t) ((uint32_t) F_CPU/ (8 * 38400L) - 1); |
1782 | ingob | 534 | |
1783 | killagreg | 535 | cli(); |
1782 | ingob | 536 | |
1783 | killagreg | 537 | // UART0 & UART1 disable RX and TX-Interrupt |
538 | UCSR0B &= ~((1 << RXCIE0)|(1 << TXCIE0)); |
||
539 | UCSR1B &= ~((1 << RXCIE1)|(1 << TXCIE1)); |
||
540 | |||
541 | // UART0 & UART1 disable receiver and transmitter |
||
542 | UCSR0B &= ~((1 << TXEN0) | (1 << RXEN0)); |
||
543 | UCSR1B &= ~((1 << TXEN1) | (1 << RXEN1)); |
||
544 | |||
545 | // UART0 & UART1 flush receive buffer explicit |
||
546 | while ( UCSR1A & (1<<RXC1) ) UDR1; |
||
547 | while ( UCSR0A & (1<<RXC0) ) UDR0; |
||
548 | |||
549 | |||
550 | if (pRxData[0] == 0) |
||
551 | { |
||
552 | JetiUpdateModeActive = 1; |
||
553 | |||
554 | // UART0 & UART1 set baudrate |
||
555 | UBRR1H = (uint8_t)(ubrr>>8); |
||
556 | UBRR1L = (uint8_t)ubrr; |
||
557 | UBRR0H = UBRR1H; |
||
558 | UBRR0L = UBRR1L; |
||
559 | // UART1 no parity |
||
560 | UCSR1C &= ~(1 << UPM11); |
||
561 | UCSR1C &= ~(1 << UPM10); |
||
562 | // UART1 8-bit |
||
563 | UCSR1B &= ~(1 << UCSZ12); |
||
564 | UCSR1C |= (1 << UCSZ11); |
||
565 | UCSR1C |= (1 << UCSZ10); |
||
566 | } |
||
567 | else JetiUpdateModeActive = 2; |
||
568 | |||
569 | // UART0 & UART1 1 stop bit |
||
570 | UCSR1C &= ~(1 << USBS1); |
||
571 | UCSR0C &= ~(1 << USBS0); |
||
572 | // UART1 clear 9th bit |
||
573 | UCSR1B &= ~(1<<TXB81); |
||
574 | // enable receiver and transmitter for UART0 and UART1 |
||
575 | UCSR0B |= (1 << TXEN0) | (1 << RXEN0); |
||
576 | UCSR1B |= (1 << TXEN1) | (1 << RXEN1); |
||
577 | // enable RX-Interrupt for UART0 and UART1 |
||
578 | UCSR0B |= (1 << RXCIE0); |
||
579 | UCSR1B |= (1 << RXCIE1); |
||
580 | // disable other Interrupts |
||
581 | TIMSK0 = 0; |
||
582 | TIMSK1 = 0; |
||
583 | TIMSK2 = 0; |
||
584 | |||
585 | sei(); |
||
1777 | ingob | 586 | } |
1897 | - | 587 | |
588 | #else |
||
589 | #warning : "### without jeti update command ###" |
||
590 | |||
591 | #endif |
||
1777 | ingob | 592 | break; |
593 | |||
1056 | killagreg | 594 | } // case FC_ADDRESS: |
1054 | killagreg | 595 | |
596 | default: // any Slave Address |
||
1056 | killagreg | 597 | |
1054 | killagreg | 598 | switch(RxdBuffer[2]) |
599 | { |
||
600 | // 't' comand placed here only for compatibility to BL |
||
601 | case 't':// Motortest |
||
1662 | killagreg | 602 | if(AnzahlEmpfangsBytes >= sizeof(MotorTest)) memcpy(&MotorTest[0], (unsigned char *)pRxData, sizeof(MotorTest)); |
1212 | hbuss | 603 | else memcpy(&MotorTest[0], (unsigned char *)pRxData, 4); |
1054 | killagreg | 604 | while(!UebertragungAbgeschlossen); |
605 | SendOutData('T', MeineSlaveAdresse, 0); |
||
1212 | hbuss | 606 | PC_MotortestActive = 250; |
1054 | killagreg | 607 | PcZugriff = 255; |
1638 | holgerb | 608 | AboTimeOut = SetDelay(ABO_TIMEOUT); |
1054 | killagreg | 609 | break; |
610 | // 'K' comand placed here only for compatibility to old MK3MAG software, that does not send the right Slave Address |
||
611 | case 'K':// Kompasswert |
||
612 | memcpy((unsigned char *)&KompassValue , (unsigned char *)pRxData, sizeof(KompassValue)); |
||
1837 | holgerb | 613 | KompassRichtung = ((540 + KompassValue - KompassSollWert) % 360) - 180; |
1054 | killagreg | 614 | break; |
615 | case 'a':// Texte der Analogwerte |
||
616 | DebugTextAnforderung = pRxData[0]; |
||
617 | if (DebugTextAnforderung > 31) DebugTextAnforderung = 31; |
||
618 | PcZugriff = 255; |
||
619 | break; |
||
620 | case 'b': |
||
621 | memcpy((unsigned char *)&ExternControl, (unsigned char *)pRxData, sizeof(ExternControl)); |
||
622 | ConfirmFrame = ExternControl.Frame; |
||
623 | PcZugriff = 255; |
||
624 | break; |
||
1171 | hbuss | 625 | case 'c': // Poll the 3D-Data |
626 | if(!Intervall3D) { if(pRxData[0]) Timer3D = SetDelay(pRxData[0] * 10);} |
||
627 | Intervall3D = pRxData[0] * 10; |
||
1417 | killagreg | 628 | AboTimeOut = SetDelay(ABO_TIMEOUT); |
1171 | hbuss | 629 | break; |
1054 | killagreg | 630 | case 'd': // Poll the debug data |
1438 | ingob | 631 | PcZugriff = 255; |
1399 | killagreg | 632 | DebugDataIntervall = (unsigned int)pRxData[0] * 10; |
1171 | hbuss | 633 | if(DebugDataIntervall > 0) DebugDataAnforderung = 1; |
1415 | killagreg | 634 | AboTimeOut = SetDelay(ABO_TIMEOUT); |
1054 | killagreg | 635 | break; |
636 | |||
637 | case 'h':// x-1 Displayzeilen |
||
1897 | - | 638 | |
639 | #ifdef WITH_MKTOOL_Dispay /// MartinW memorysave |
||
640 | #warning : "### with MKTool Display ###" |
||
641 | |||
1059 | hbuss | 642 | PcZugriff = 255; |
1399 | killagreg | 643 | if((pRxData[0] & 0x80) == 0x00) // old format |
644 | { |
||
645 | DisplayLine = 2; |
||
646 | Display_Interval = 0; |
||
647 | } |
||
648 | else // new format |
||
649 | { |
||
650 | RemoteKeys |= ~pRxData[0]; |
||
651 | Display_Interval = (unsigned int)pRxData[1] * 10; |
||
652 | DisplayLine = 4; |
||
1415 | killagreg | 653 | AboTimeOut = SetDelay(ABO_TIMEOUT); |
1399 | killagreg | 654 | } |
1054 | killagreg | 655 | DebugDisplayAnforderung = 1; |
656 | break; |
||
657 | |||
658 | case 'l':// x-1 Displayzeilen |
||
1059 | hbuss | 659 | PcZugriff = 255; |
1054 | killagreg | 660 | MenuePunkt = pRxData[0]; |
661 | DebugDisplayAnforderung1 = 1; |
||
1897 | - | 662 | |
663 | #endif |
||
1054 | killagreg | 664 | break; |
1897 | - | 665 | |
666 | |||
1054 | killagreg | 667 | case 'v': // Version-Anforderung und Ausbaustufe |
668 | GetVersionAnforderung = 1; |
||
669 | break; |
||
670 | |||
671 | case 'g':// |
||
672 | GetExternalControl = 1; |
||
673 | break; |
||
1657 | killagreg | 674 | |
675 | default: |
||
676 | //unsupported command received |
||
677 | break; |
||
1054 | killagreg | 678 | } |
679 | break; // default: |
||
680 | } |
||
1051 | killagreg | 681 | NeuerDatensatzEmpfangen = 0; |
682 | pRxData = 0; |
||
683 | RxDataLen = 0; |
||
1 | ingob | 684 | } |
685 | |||
686 | //############################################################################ |
||
687 | //Routine für die Serielle Ausgabe |
||
1444 | ingob | 688 | void uart_putchar (char c) |
1 | ingob | 689 | //############################################################################ |
690 | { |
||
691 | //Warten solange bis Zeichen gesendet wurde |
||
1561 | killagreg | 692 | loop_until_bit_is_set(UCSR0A, UDRE0); |
1 | ingob | 693 | //Ausgabe des Zeichens |
1561 | killagreg | 694 | UDR0 = c; |
1 | ingob | 695 | } |
696 | |||
697 | |||
698 | //############################################################################ |
||
699 | //INstallation der Seriellen Schnittstelle |
||
700 | void UART_Init (void) |
||
701 | //############################################################################ |
||
702 | { |
||
1561 | killagreg | 703 | unsigned int ubrr = (unsigned int) ((unsigned long) F_CPU/(8 * USART0_BAUD) - 1); |
704 | |||
1 | ingob | 705 | //Enable TXEN im Register UCR TX-Data Enable & RX Enable |
1561 | killagreg | 706 | UCSR0B = (1 << TXEN0) | (1 << RXEN0); |
1 | ingob | 707 | // UART Double Speed (U2X) |
1561 | killagreg | 708 | UCSR0A |= (1 << U2X0); |
1 | ingob | 709 | // RX-Interrupt Freigabe |
1561 | killagreg | 710 | UCSR0B |= (1 << RXCIE0); |
1 | ingob | 711 | // TX-Interrupt Freigabe |
1561 | killagreg | 712 | UCSR0B |= (1 << TXCIE0); |
713 | // USART0 Baud Rate Register |
||
714 | // set clock divider |
||
715 | UBRR0H = (uint8_t)(ubrr >> 8); |
||
716 | UBRR0L = (uint8_t)ubrr; |
||
1 | ingob | 717 | |
1051 | killagreg | 718 | Debug_Timer = SetDelay(DebugDataIntervall); |
719 | Kompass_Timer = SetDelay(220); |
||
720 | |||
1058 | killagreg | 721 | VersionInfo.SWMajor = VERSION_MAJOR; |
722 | VersionInfo.SWMinor = VERSION_MINOR; |
||
723 | VersionInfo.SWPatch = VERSION_PATCH; |
||
724 | VersionInfo.ProtoMajor = VERSION_SERIAL_MAJOR; |
||
725 | VersionInfo.ProtoMinor = VERSION_SERIAL_MINOR; |
||
1051 | killagreg | 726 | |
727 | pRxData = 0; |
||
728 | RxDataLen = 0; |
||
1 | ingob | 729 | } |
730 | |||
731 | //--------------------------------------------------------------------------------------------- |
||
1051 | killagreg | 732 | void DatenUebertragung(void) |
1 | ingob | 733 | { |
1415 | killagreg | 734 | if(!UebertragungAbgeschlossen) return; |
1 | ingob | 735 | |
1415 | killagreg | 736 | if(CheckDelay(AboTimeOut)) |
737 | { |
||
738 | Display_Interval = 0; |
||
739 | DebugDataIntervall = 0; |
||
1417 | killagreg | 740 | Intervall3D = 0; |
1415 | killagreg | 741 | } |
742 | |||
1897 | - | 743 | #ifdef WITH_MKTOOL_Display //main.h |
744 | #warning : "### with MKTool Display ###" |
||
745 | |||
1399 | killagreg | 746 | if(((Display_Interval>0 && CheckDelay(Display_Timer)) || DebugDisplayAnforderung) && UebertragungAbgeschlossen) |
1065 | killagreg | 747 | { |
1399 | killagreg | 748 | if(DisplayLine > 3)// new format |
749 | { |
||
1423 | hbuss | 750 | Menu(); |
1399 | killagreg | 751 | SendOutData('H', FC_ADDRESS, 1, (uint8_t *)DisplayBuff, 80); |
752 | } |
||
753 | else // old format |
||
754 | { |
||
755 | LCD_printfxy(0,0,"!!! INCOMPATIBLE !!!"); |
||
756 | SendOutData('H', FC_ADDRESS, 2, &DisplayLine, sizeof(DisplayLine), (uint8_t *)DisplayBuff, 20); |
||
757 | if(DisplayLine++ > 3) DisplayLine = 0; |
||
758 | } |
||
759 | Display_Timer = SetDelay(Display_Interval); |
||
1065 | killagreg | 760 | DebugDisplayAnforderung = 0; |
761 | } |
||
762 | if(DebugDisplayAnforderung1 && UebertragungAbgeschlossen) |
||
763 | { |
||
764 | Menu(); |
||
765 | SendOutData('L', FC_ADDRESS, 3, &MenuePunkt, sizeof(MenuePunkt), &MaxMenue, sizeof(MaxMenue), DisplayBuff, sizeof(DisplayBuff)); |
||
766 | DebugDisplayAnforderung1 = 0; |
||
767 | } |
||
1897 | - | 768 | |
769 | #endif |
||
770 | |||
1065 | killagreg | 771 | if(GetVersionAnforderung && UebertragungAbgeschlossen) |
772 | { |
||
773 | SendOutData('V', FC_ADDRESS, 1, (unsigned char *) &VersionInfo, sizeof(VersionInfo)); |
||
774 | GetVersionAnforderung = 0; |
||
1636 | ingob | 775 | Debug_OK("Version gesendet"); |
1065 | killagreg | 776 | } |
1 | ingob | 777 | |
1065 | killagreg | 778 | if(GetExternalControl && UebertragungAbgeschlossen) // Bei Get werden die vom PC einstellbaren Werte vom PC zurückgelesen |
779 | { |
||
780 | SendOutData('G',MeineSlaveAdresse, 1, (unsigned char *) &ExternControl, sizeof(ExternControl)); |
||
781 | GetExternalControl = 0; |
||
782 | } |
||
1051 | killagreg | 783 | if((CheckDelay(Kompass_Timer)) && UebertragungAbgeschlossen) |
693 | hbuss | 784 | { |
1171 | hbuss | 785 | WinkelOut.Winkel[0] = (int) (IntegralNick / (EE_Parameter.GyroAccFaktor * 4)); // etwa in 0.1 Grad |
786 | WinkelOut.Winkel[1] = (int) (IntegralRoll / (EE_Parameter.GyroAccFaktor * 4)); // etwa in 0.1 Grad |
||
717 | hbuss | 787 | WinkelOut.UserParameter[0] = Parameter_UserParam1; |
788 | WinkelOut.UserParameter[1] = Parameter_UserParam2; |
||
1619 | killagreg | 789 | SendOutData('k', MK3MAG_ADDRESS, 1, (unsigned char *) &WinkelOut,sizeof(WinkelOut)); |
855 | hbuss | 790 | if(WinkelOut.CalcState > 4) WinkelOut.CalcState = 6; // wird dann in SPI auf Null gesetzt |
1051 | killagreg | 791 | Kompass_Timer = SetDelay(99); |
792 | } |
||
1171 | hbuss | 793 | if(((DebugDataIntervall>0 && CheckDelay(Debug_Timer)) || DebugDataAnforderung) && UebertragungAbgeschlossen) |
1 | ingob | 794 | { |
1639 | holgerb | 795 | CopyDebugValues(); |
1276 | hbuss | 796 | SendOutData('D', FC_ADDRESS, 1, (unsigned char *) &DebugOut,sizeof(DebugOut)); |
1 | ingob | 797 | DebugDataAnforderung = 0; |
1055 | ingob | 798 | if(DebugDataIntervall>0) Debug_Timer = SetDelay(DebugDataIntervall); |
1051 | killagreg | 799 | } |
1171 | hbuss | 800 | if(Intervall3D > 0 && CheckDelay(Timer3D) && UebertragungAbgeschlossen) |
801 | { |
||
802 | Data3D.Winkel[0] = (int) (IntegralNick / (EE_Parameter.GyroAccFaktor * 4)); // etwa in 0.1 Grad |
||
803 | Data3D.Winkel[1] = (int) (IntegralRoll / (EE_Parameter.GyroAccFaktor * 4)); // etwa in 0.1 Grad |
||
804 | Data3D.Winkel[2] = (int) ((10 * ErsatzKompass) / GIER_GRAD_FAKTOR); |
||
1685 | holgerb | 805 | Data3D.Centroid[0] = SummeNick >> 9; |
806 | Data3D.Centroid[1] = SummeRoll >> 9; |
||
807 | Data3D.Centroid[2] = Mess_Integral_Gier >> 9; |
||
1171 | hbuss | 808 | SendOutData('C', FC_ADDRESS, 1, (unsigned char *) &Data3D,sizeof(Data3D)); |
809 | Timer3D = SetDelay(Intervall3D); |
||
810 | } |
||
499 | hbuss | 811 | if(DebugTextAnforderung != 255) // Texte für die Analogdaten |
812 | { |
||
1897 | - | 813 | |
814 | |||
815 | |||
816 | #ifdef WITH_FULL_ANALOG_TEXT /// MartinW main.h means no memsave |
||
817 | #warning : "### with normal ANALOG_TEXT[32][16] ###" |
||
1490 | killagreg | 818 | unsigned char label[16]; // local sram buffer |
819 | memcpy_P(label, ANALOG_TEXT[DebugTextAnforderung], 16); // read lable from flash to sra |
||
1897 | - | 820 | SendOutData('A', FC_ADDRESS, 2, (unsigned char *)&DebugTextAnforderung, sizeof(DebugTextAnforderung),label, 16); |
821 | |||
822 | #else |
||
823 | #warning : "### with reduced ANALOG_TEXT[32][13] ###" |
||
824 | |||
825 | unsigned char label[16]=" "; // local sram buffer ///MartinW; for MKTool, needs 32 bytes |
||
826 | memcpy_P(label, ANALOG_TEXT[DebugTextAnforderung], 13); // read lable from flash to sra |
||
1490 | killagreg | 827 | SendOutData('A', FC_ADDRESS, 2, (unsigned char *)&DebugTextAnforderung, sizeof(DebugTextAnforderung),label, 16); |
1897 | - | 828 | #endif |
829 | |||
830 | |||
831 | |||
499 | hbuss | 832 | DebugTextAnforderung = 255; |
833 | } |
||
1051 | killagreg | 834 | if(ConfirmFrame && UebertragungAbgeschlossen) // Datensatz bestätigen |
595 | hbuss | 835 | { |
1054 | killagreg | 836 | SendOutData('B', FC_ADDRESS, 1, (uint8_t*)&ConfirmFrame, sizeof(ConfirmFrame)); |
1051 | killagreg | 837 | ConfirmFrame = 0; |
595 | hbuss | 838 | } |
1053 | killagreg | 839 | |
1051 | killagreg | 840 | if(GetPPMChannelAnforderung && UebertragungAbgeschlossen) |
841 | { |
||
1054 | killagreg | 842 | SendOutData('P', FC_ADDRESS, 1, (unsigned char *) &PPM_in, sizeof(PPM_in)); |
1051 | killagreg | 843 | GetPPMChannelAnforderung = 0; |
844 | } |
||
1654 | killagreg | 845 | |
1636 | ingob | 846 | #ifdef DEBUG // only include functions if DEBUG is defined |
847 | if(SendDebugOutput && UebertragungAbgeschlossen) |
||
848 | { |
||
849 | SendOutData('0', FC_ADDRESS, 1, (unsigned char *) &tDebug, sizeof(tDebug)); |
||
850 | SendDebugOutput = 0; |
||
851 | } |
||
1654 | killagreg | 852 | #endif |
1 | ingob | 853 | |
854 | } |
||
855 | |||
1636 | ingob | 856 |