#include const char pmSystemHardwareType[] PROGMEM = "xnode-base"; const char pmSystemHardwareVersion[] PROGMEM = XNODE_VERSION; const char pmSysTestLeds[] PROGMEM = "System leds test"; byte CONFIG_DEFAULT_NET_MAC[] = NET_XNODE_MAC_DEFAULT; unsigned long blink_timer = ZERO; uint8_t blink_led = ZERO; uint8_t blink_status = ZERO; xnode_base_config_t config; xnode_base_config_t EEMEM eeprom; XnodeBaseHardware XBHardware; void XnodeBaseHardware::begin() { pinMode(HW_PIN_ERROR_LED, OUTPUT); pinMode(HW_PIN_RADIO_LED, OUTPUT); pinMode(HW_PIN_NETWORK_LED, OUTPUT); changeLed(SYS_LED_ERROR, SYS_LED_STATUS_ON); changeLed(SYS_LED_RADIO, SYS_LED_STATUS_ON); changeLed(SYS_LED_NETWORK, SYS_LED_STATUS_ON); XSerial.printCommentLineP(pmSysTestLeds); delay(SYS_LED_TEST_TIME); // let users see all leds changeLed(SYS_LED_ERROR, SYS_LED_STATUS_OFF); changeLed(SYS_LED_RADIO, SYS_LED_STATUS_OFF); changeLed(SYS_LED_NETWORK, SYS_LED_STATUS_OFF); } void XnodeBaseHardware::loop() { loopBlink(); } bool XnodeBaseHardware::systemHardwareConfigBegin() { eeprom_read_block((void*) &config, (void*) &eeprom, sizeof(xnode_base_config_t)); if (config.eeprom_struct_size != sizeof(xnode_base_config_t)) { return true; } config.sys_boot++; return false; } void XnodeBaseHardware::systemHardwareConfigSave() { config.eeprom_struct_size = sizeof(xnode_base_config_t); eeprom_write_block((const void*) &config, (void*) &eeprom, sizeof(xnode_base_config_t)); } void XnodeBaseHardware::systemHardwareConfigReset() { // Temp code way config.net_mac[0] = ZERO; config.net_mac[1] = ZERO; config.net_mac[2] = ZERO; config.net_mac[3] = ZERO; config.net_mac[4] = ZERO; config.net_mac[5] = ZERO; config.net_ip[0] = ZERO; config.net_ip[1] = ZERO; config.net_ip[2] = ZERO; config.net_ip[3] = ZERO; config.net_mask[0] = ZERO; config.net_mask[1] = ZERO; config.net_mask[2] = ZERO; config.net_mask[3] = ZERO; config.net_gate[0] = ZERO; config.net_gate[1] = ZERO; config.net_gate[2] = ZERO; config.net_gate[3] = ZERO; config.net_dns[0] = ZERO; config.net_dns[1] = ZERO; config.net_dns[2] = ZERO; config.net_dns[3] = ZERO; config.sys_boot = ZERO; // end Temp // TODO: Temp fix cast~~ so clear config zering all in one go. //for (uint16_t i=ZERO;i