@@ -306,25 +306,58 @@ void _processInternalMessages() {
306
306
// Deliver time to callback
307
307
if (receiveTime)
308
308
receiveTime (_msg.getULong ());
309
- }
310
- #if defined(MY_REPEATER_FEATURE)
311
- if (type == I_CHILDREN) {
312
- if (_msg.getString ()[0 ] == ' C' ) {
313
- // Clears child relay data for this node
314
- debug (PSTR (" clear routing table\n " ));
315
- uint8_t i = 255 ;
316
- do {
317
- hwWriteConfig (EEPROM_ROUTES_ADDRESS+i, BROADCAST_ADDRESS);
318
- } while (i--);
319
- // Clear parent node id & distance to gw
320
- hwWriteConfig (EEPROM_PARENT_NODE_ID_ADDRESS, AUTO);
321
- hwWriteConfig (EEPROM_DISTANCE_ADDRESS, DISTANCE_INVALID);
322
- // Find parent node
323
- transportFindParentNode ();
324
- _sendRoute (build (_msg, _nc.nodeId , GATEWAY_ADDRESS, NODE_SENSOR_ID, C_INTERNAL, I_CHILDREN,false ).set (" " ));
309
+ } else if (type == I_CHILDREN) {
310
+ #if defined(MY_REPEATER_FEATURE)
311
+ if (_msg.data [0 ] == ' C' ) {
312
+ // Clears child relay data for this node
313
+ debug (PSTR (" clear routing table\n " ));
314
+ uint8_t i = 255 ;
315
+ do {
316
+ hwWriteConfig (EEPROM_ROUTES_ADDRESS+i, BROADCAST_ADDRESS);
317
+ } while (i--);
318
+ // Clear parent node id & distance to gw
319
+ hwWriteConfig (EEPROM_PARENT_NODE_ID_ADDRESS, AUTO);
320
+ hwWriteConfig (EEPROM_DISTANCE_ADDRESS, DISTANCE_INVALID);
321
+ // Find parent node
322
+ transportFindParentNode ();
323
+ _sendRoute (build (_msg, _nc.nodeId , GATEWAY_ADDRESS, NODE_SENSOR_ID, C_INTERNAL, I_CHILDREN,false ).set (" ok" ));
324
+ }
325
+ #endif
326
+ } else if (type == I_DEBUG) {
327
+ #if defined(MY_DEBUG) || defined(MY_SPECIAL_DEBUG)
328
+ char debug_msg = _msg.data [0 ];
329
+ if (debug_msg == ' R' ){
330
+ #if defined(MY_REPEATER_FEATURE)
331
+ // routing table
332
+ for (uint8_t cnt=0 ; cnt!=255 ;cnt++){
333
+ uint8_t route = hwReadConfig (EEPROM_ROUTES_ADDRESS+cnt);
334
+ if (route!=BROADCAST_ADDRESS){
335
+ debug (PSTR (" ID: %d via %d\n " ),cnt,route);
336
+ uint8_t OutBuf[2 ] = {cnt,route};
337
+ _sendRoute (build (_msgTmp, _nc.nodeId , GATEWAY_ADDRESS, NODE_SENSOR_ID, C_INTERNAL, I_DEBUG,false ).set (OutBuf,2 ));
338
+ wait (100 );
339
+ }
340
+ }
341
+ #endif
342
+ } else if (debug_msg == ' V' ){
343
+ // CPU voltage
344
+ _sendRoute (build (_msgTmp, _nc.nodeId , GATEWAY_ADDRESS, NODE_SENSOR_ID, C_INTERNAL, I_DEBUG,false ).set (hwCPUVoltage ()));
345
+ } else if (debug_msg == ' F' ) {
346
+ // CPU frequency in 1/10Mhz
347
+ _sendRoute (build (_msgTmp, _nc.nodeId , GATEWAY_ADDRESS, NODE_SENSOR_ID, C_INTERNAL, I_DEBUG,false ).set (hwCPUFrequency ()));
348
+ } else if (debug_msg == ' M' ) {
349
+ // free memory
350
+ _sendRoute (build (_msgTmp, _nc.nodeId , GATEWAY_ADDRESS, NODE_SENSOR_ID, C_INTERNAL, I_DEBUG,false ).set (hwFreeMem ()));
351
+ } else if (debug_msg == ' E' ) {
352
+ // clear MySensors eeprom area and reboot
353
+ _sendRoute (build (_msgTmp, _nc.nodeId , GATEWAY_ADDRESS, NODE_SENSOR_ID, C_INTERNAL, I_CHILDREN,false ).set (" ok" ));
354
+ for (int i=EEPROM_START;i<EEPROM_LOCAL_CONFIG_ADDRESS;i++) {
355
+ hwWriteConfig (i,0xFF );
356
+ }
357
+ hwReboot ();
325
358
}
326
- }
327
- # endif
359
+ # endif
360
+ }
328
361
}
329
362
330
363
0 commit comments