@@ -327,7 +327,8 @@ uint8_t EEMEM Fun_trace_array[FUNTRACE_ARRAY_SIZE+FUNTRACE_HEADER_LEN]; //eepro
327327
328328uint16_t EEMEM funtrace_was_activated ; //word in eeprom to indicate that funtrace was activated
329329
330-
330+ uint16_t EEMEM eeSC_mask ;
331+ uint8_t EEMEM eeSC_already_sent_from_server ;
331332
332333
333334
@@ -649,7 +650,16 @@ void init(void)
649650 }
650651
651652
652- xbee_init (& paint_info_line ,NULL ,0 );
653+ uint16_t SC_mask = eeprom_read_word (& eeSC_mask );
654+ uint8_t SC_aleady_sent_from_server = eeprom_read_byte (& eeSC_already_sent_from_server );
655+
656+ if (SC_aleady_sent_from_server == SC_already_received_Pattern ){
657+ xbee_init (& paint_info_line ,NULL ,0 ,SC_mask );
658+ }else
659+ {
660+ xbee_init (& paint_info_line ,NULL ,0 ,SC_MASK_DEFAULT );
661+ }
662+
653663
654664 xbee_hardware_version ();
655665 Print_add_Line (STR_INIT_DONE ,0 );
@@ -1213,7 +1223,29 @@ void execute_server_CMDS(uint8_t reply_id){
12131223 sendbuffer [0 ] = 0 ;
12141224 xbee_send_message (SET_PING_INTERVALL_CMD ,sendbuffer ,1 );
12151225 break ;
1226+
1227+ case SET_SC_XBEE_MASK :;
1228+ uint16_t SC_mask = (frameBuffer [reply_id ].data [0 ]<<8 ) + frameBuffer [reply_id ].data [1 ];
12161229
1230+
1231+ // write new sc mask to eeprom
1232+ eeprom_update_word (& eeSC_mask , SC_mask );
1233+ eeprom_update_byte (& eeSC_already_sent_from_server ,SC_already_received_Pattern );
1234+
1235+ //refresh xbee parameters
1236+
1237+ xbee_init (& paint_info_line ,NULL ,0 ,SC_mask );
1238+ xbee_Set_Scan_Channels (xbee .ScanChannels );
1239+ xbee_WR ();
1240+
1241+ //Send Status Ack
1242+ sendbuffer [0 ] = 0 ;
1243+ xbee_send_message (SET_SC_XBEE_MASK ,sendbuffer ,1 );
1244+
1245+
1246+
1247+
1248+ break ;
12171249
12181250
12191251 #ifdef USE_LAN
@@ -1248,12 +1280,12 @@ void execute_server_CMDS(uint8_t reply_id){
12481280 {
12491281
12501282
1251- xbee_pseudo_send_AT_response (
1252- AT_Lut [(uint8_t )(AT_Code - AT_START )][0 ], // translate AT_code back to At ASCII chars
1253- AT_Lut [(uint8_t )(AT_Code - AT_START )][1 ],
1254- 1 , // Status == 1 --> atcommand not known
1255- sendbuffer ,
1256- 0 ); // empty payload
1283+ xbee_pseudo_send_AT_response (
1284+ AT_Lut [(uint8_t )(AT_Code - AT_START )][0 ], // translate AT_code back to At ASCII chars
1285+ AT_Lut [(uint8_t )(AT_Code - AT_START )][1 ],
1286+ 1 , // Status == 1 --> atcommand not known
1287+ sendbuffer ,
1288+ 0 ); // empty payload
12571289 }
12581290
12591291 break ;
@@ -1823,7 +1855,7 @@ int main(void)
18231855 char boundsstr [100 ];
18241856 for (uint8_t i = 0 ;i < StartStat .bound_err_counter ; i ++ ){
18251857 uint8_t errVal = StartStat .boundsErrors [i ];
1826-
1858+
18271859
18281860 sprintf (boundsstr ,STR_RANGE_ERROR ,
18291861 StartStat .optStrings [errVal ],
@@ -2037,7 +2069,7 @@ int main(void)
20372069 {
20382070
20392071
2040-
2072+
20412073
20422074 Collect_Measurement_Data ();
20432075
0 commit comments