Merge pull request #470 from tekka007/FixIndication

Fix MyIndication definitions
This commit is contained in:
Patrick Fallberg
2016-06-12 15:32:04 +02:00
committed by GitHub
5 changed files with 17 additions and 10 deletions
+1 -1
View File
@@ -26,7 +26,7 @@
static uint8_t countRx; static uint8_t countRx;
static uint8_t countTx; static uint8_t countTx;
static uint8_t countErr; static uint8_t countErr;
static unsigned long prevTime = millis() - LED_PROCESS_INTERVAL_MS; // Substract some, to make sure leds gets updated on first run. static unsigned long prevTime = hwMillis() - LED_PROCESS_INTERVAL_MS; // Substract some, to make sure leds gets updated on first run.
inline void ledsInit() inline void ledsInit()
@@ -38,7 +38,6 @@ inline void firmwareOTAUpdateRequest() {
debug(PSTR("fw upd fail\n")); debug(PSTR("fw upd fail\n"));
// Give up. We have requested MY_OTA_RETRY times without any packet in return. // Give up. We have requested MY_OTA_RETRY times without any packet in return.
_fwUpdateOngoing = false; _fwUpdateOngoing = false;
ledBlinkErr(1);
return; return;
} }
_fwRetry--; _fwRetry--;
@@ -58,7 +57,7 @@ inline bool firmwareOTAUpdateProcess() {
NodeFirmwareConfig *firmwareConfigResponse = (NodeFirmwareConfig *)_msg.data; NodeFirmwareConfig *firmwareConfigResponse = (NodeFirmwareConfig *)_msg.data;
// compare with current node configuration, if they differ, start fw fetch process // compare with current node configuration, if they differ, start fw fetch process
if (memcmp(&_fc,firmwareConfigResponse,sizeof(NodeFirmwareConfig))) { if (memcmp(&_fc,firmwareConfigResponse,sizeof(NodeFirmwareConfig))) {
setIndication(INDICATION_FW_START); setIndication(INDICATION_FW_UPDATE_START);
debug(PSTR("fw update\n")); debug(PSTR("fw update\n"));
// copy new FW config // copy new FW config
memcpy(&_fc,firmwareConfigResponse,sizeof(NodeFirmwareConfig)); memcpy(&_fc,firmwareConfigResponse,sizeof(NodeFirmwareConfig));
@@ -84,7 +83,7 @@ inline bool firmwareOTAUpdateProcess() {
} else if (_msg.type == ST_FIRMWARE_RESPONSE) { } else if (_msg.type == ST_FIRMWARE_RESPONSE) {
if (_fwUpdateOngoing) { if (_fwUpdateOngoing) {
// Save block to flash // Save block to flash
setIndication(INDICATION_FW_RX); setIndication(INDICATION_FW_UPDATE_RX);
debug(PSTR("fw block %d\n"), _fwBlock); debug(PSTR("fw block %d\n"), _fwBlock);
// extract FW block // extract FW block
ReplyFWBlock *firmwareResponse = (ReplyFWBlock *)_msg.data; ReplyFWBlock *firmwareResponse = (ReplyFWBlock *)_msg.data;
@@ -54,13 +54,13 @@ static Adafruit_NeoPixel pixels = Adafruit_NeoPixel(1, NEO_PIN, NEO_GRB + NEO_KH
// Change to V_LIGHT if you use S_LIGHT in presentation below // Change to V_LIGHT if you use S_LIGHT in presentation below
MyMessage msg(CHILD_ID,V_TRIPPED); MyMessage msg(CHILD_ID,V_TRIPPED);
#define BLINK_TIMES(x) (x<<4) #define BLINK_TIMES(x) ((x)<<4)
static uint8_t ledR = 0; static uint8_t ledR = 0;
static uint8_t ledG = 0; static uint8_t ledG = 0;
static uint8_t ledB = 0; static uint8_t ledB = 0;
static void updateLed(void) void updateLed(void)
{ {
// Update the pattern (setting leds). // Update the pattern (setting leds).
if (ledR > 0) --ledR; if (ledR > 0) --ledR;
@@ -65,8 +65,12 @@
#endif #endif
// When W5100 is connected we have to move CE/CSN pins for NRF radio // When W5100 is connected we have to move CE/CSN pins for NRF radio
#define MY_RF24_CE_PIN 5 #ifndef MY_RF24_CE_PIN
#define MY_RF24_CS_PIN 6 #define MY_RF24_CE_PIN 5
#endif
#ifndef MY_RF24_CS_PIN
#define MY_RF24_CS_PIN 6
#endif
// Enable to UDP // Enable to UDP
//#define MY_USE_UDP //#define MY_USE_UDP
@@ -89,8 +89,12 @@
#endif #endif
// When W5100 is connected we have to move CE/CSN pins for NRF radio // When W5100 is connected we have to move CE/CSN pins for NRF radio
#define MY_RF24_CE_PIN 5 #ifndef MY_RF24_CE_PIN
#define MY_RF24_CS_PIN 6 #define MY_RF24_CE_PIN 5
#endif
#ifndef MY_RF24_CS_PIN
#define MY_RF24_CS_PIN 6
#endif
// Enable these if your MQTT broker requires usenrame/password // Enable these if your MQTT broker requires usenrame/password
//#define MY_MQTT_USER "username" //#define MY_MQTT_USER "username"