Static IDs


  • Admin

    A static ID is not saved in eeprom. As a consequence, OTA bootloader will request new ID for bootloading, until the sketch takes over with the static ID.

    Resolution in MySensors.cpp / MySensor::begin procedure

    if ( (_nodeId != AUTO) && (nc.nodeId != _nodeId) ) {
    	// Set static id
    	nc.nodeId = _nodeId;
    	// Save static id in eeprom
    	eeprom_write_byte((uint8_t*)EEPROM_NODE_ID_ADDRESS, _nodeId);
    }

  • Admin

    @tekka

    Thanks, will be added.


  • Admin

    @hek

    Same for static parent node id in MySensors.cpp / MySensor::begin procedure:

    Resolution:

    if ( (_parentNodeId != AUTO) && (nc.parentNodeId != _parentNodeId) ) {
    	// Set static parent id
    	nc.parentNodeId = _parentNodeId;
    	// Save static parent id in eeprom
    	eeprom_write_byte((uint8_t*)EEPROM_PARENT_NODE_ID_ADDRESS, _parentNodeId);
    	autoFindParent = false;
    } else {
    	autoFindParent = true;
    }
    

    A general thought: If the parent node is not static (there are a few cases where static parent nodes make sense), it would be better to re-discover the closest node/repeater during each startup. This concept makes also more sense for OTA bootloading - you do not want to have an assigned parent node that is eventually down...


  • Admin

    Agree, but I think the bootloader code size must be kept to a bare minimum (I didn't write that part).


  • Admin

    @hek the findParentNode() part is already part of the initial OTA bootloader and only takes a few lines.


  • Admin

    @tekka

    Haha.. ok. I see. someone should probably take care of the bootloader code while @ToSa is busy..


 

339
Online

8.2k
Users

9.0k
Topics

96.0k
Posts