Browse Source

Merge branch 'dev' of github.com:xoseperez/espurna into dev

alexa
Xose Pérez 5 years ago
parent
commit
d2d92687c1
3 changed files with 18 additions and 5 deletions
  1. +8
    -1
      code/build.sh
  2. +1
    -1
      code/espurna/ntp.ino
  3. +9
    -3
      code/espurna/rfbridge.ino

+ 8
- 1
code/build.sh View File

@ -9,6 +9,13 @@ is_git() {
return 0 return 0
} }
stat_bytes() {
case "$(uname -s)" in
Darwin) stat -f %z "$1";;
*) stat -c %s "$1";;
esac
}
# Script settings # Script settings
destination=../firmware destination=../firmware
@ -104,7 +111,7 @@ build_environments() {
for environment in $environments; do for environment in $environments; do
echo -n "* espurna-$version-$environment.bin --- " echo -n "* espurna-$version-$environment.bin --- "
platformio run --silent --environment $environment || exit 1 platformio run --silent --environment $environment || exit 1
stat -c %s .pioenvs/$environment/firmware.bin
stat_bytes .pioenvs/$environment/firmware.bin
[[ "${TRAVIS_BUILD_STAGE_NAME}" = "Test" ]] || \ [[ "${TRAVIS_BUILD_STAGE_NAME}" = "Test" ]] || \
mv .pioenvs/$environment/firmware.bin $destination/espurna-$version/espurna-$version-$environment.bin mv .pioenvs/$environment/firmware.bin $destination/espurna-$version/espurna-$version-$environment.bin
done done


+ 1
- 1
code/espurna/ntp.ino View File

@ -128,7 +128,7 @@ void _ntpBackwards() {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
bool ntpSynced() { bool ntpSynced() {
return (year() > 2017);
return (NTP.getLastNTPSync() > 0);
} }
String ntpDateTime(time_t t) { String ntpDateTime(time_t t) {


+ 9
- 3
code/espurna/rfbridge.ino View File

@ -19,6 +19,8 @@ Copyright (C) 2017-2018 by Xose Pérez <xose dot perez at gmail dot com>
// DEFINITIONS // DEFINITIONS
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// EFM8 Protocol
#define RF_MESSAGE_SIZE 9 #define RF_MESSAGE_SIZE 9
#define RF_MAX_MESSAGE_SIZE (112+4) #define RF_MAX_MESSAGE_SIZE (112+4)
#define RF_CODE_START 0xAA #define RF_CODE_START 0xAA
@ -37,6 +39,10 @@ Copyright (C) 2017-2018 by Xose Pérez <xose dot perez at gmail dot com>
#define RF_CODE_RFOUT_BUCKET 0xB0 #define RF_CODE_RFOUT_BUCKET 0xB0
#define RF_CODE_STOP 0x55 #define RF_CODE_STOP 0x55
// Settings
#define RF_MAX_KEY_LENGTH (9)
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// GLOBALS TO THE MODULE // GLOBALS TO THE MODULE
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@ -523,13 +529,13 @@ void _rfbMqttCallback(unsigned int type, const char * topic, const char * payloa
void rfbStore(unsigned char id, bool status, const char * code) { void rfbStore(unsigned char id, bool status, const char * code) {
DEBUG_MSG_P(PSTR("[RFBRIDGE] Storing %d-%s => '%s'\n"), id, status ? "ON" : "OFF", code); DEBUG_MSG_P(PSTR("[RFBRIDGE] Storing %d-%s => '%s'\n"), id, status ? "ON" : "OFF", code);
char key[8] = {0};
char key[RF_MAX_KEY_LENGTH] = {0};
snprintf_P(key, sizeof(key), PSTR("rfb%s%d"), status ? "ON" : "OFF", id); snprintf_P(key, sizeof(key), PSTR("rfb%s%d"), status ? "ON" : "OFF", id);
setSetting(key, code); setSetting(key, code);
} }
String rfbRetrieve(unsigned char id, bool status) { String rfbRetrieve(unsigned char id, bool status) {
char key[8] = {0};
char key[RF_MAX_KEY_LENGTH] = {0};
snprintf_P(key, sizeof(key), PSTR("rfb%s%d"), status ? "ON" : "OFF", id); snprintf_P(key, sizeof(key), PSTR("rfb%s%d"), status ? "ON" : "OFF", id);
return getSetting(key); return getSetting(key);
} }
@ -586,7 +592,7 @@ void rfbLearn(unsigned char id, bool status) {
void rfbForget(unsigned char id, bool status) { void rfbForget(unsigned char id, bool status) {
char key[8] = {0};
char key[RF_MAX_KEY_LENGTH] = {0};
snprintf_P(key, sizeof(key), PSTR("rfb%s%d"), status ? "ON" : "OFF", id); snprintf_P(key, sizeof(key), PSTR("rfb%s%d"), status ? "ON" : "OFF", id);
delSetting(key); delSetting(key);


Loading…
Cancel
Save