change sleepcycle to 16bit * 10

This commit is contained in:
cyberman54 committed 2021-03-27 18:52:39 +01:00
1 parent b5314f1288
commit 295494bd81
6 files changed
+13 -11

No files matched your search

+1 -1
View File
@@ -42,7 +42,7 @@ static void defaultConfig(configData_t *myconfig) {
COUNTERMODE; // 0=cyclic, 1=cumulative, 2=cyclic confirmed
myconfig->rssilimit = 0; // threshold for rssilimiter, negative value!
myconfig->sendcycle = SENDCYCLE; // payload send cycle [seconds/2]
myconfig->sleepcycle = SLEEPCYCLE; // sleep cycle [seconds/2]
myconfig->sleepcycle = SLEEPCYCLE; // sleep cycle [seconds/10]
myconfig->wifichancycle =
WIFI_CHANNEL_SWITCH_INTERVAL; // wifi channel switch cycle [seconds/100]
myconfig->blescantime =
+2 -2
View File
@@ -90,9 +90,9 @@ void irqHandler(void *pvParameters) {
// goto sleep if we have a sleep cycle
if (cfg.sleepcycle)
#ifdef HAS_BUTTON
enter_deepsleep(cfg.sleepcycle * 2, (gpio_num_t)HAS_BUTTON);
enter_deepsleep(cfg.sleepcycle * 10, (gpio_num_t)HAS_BUTTON);
#else
enter_deepsleep(cfg.sleepcycle * 2);
enter_deepsleep(cfg.sleepcycle * 10);
#endif
}
} // for
+1 -1
View File
@@ -14,7 +14,7 @@
// Payload send cycle and encoding
#define SENDCYCLE 30 // payload send cycle [seconds/2], 0 .. 255
#define SLEEPCYCLE 0 // sleep time after a send cycle [seconds/2], 0 .. 255; 0 means no sleep [default = 0]
#define SLEEPCYCLE 0 // sleep time after a send cycle [seconds/10], 0 .. 65535; 0 means no sleep [default = 0]
#define PAYLOAD_ENCODER 2 // payload encoder: 1=Plain, 2=Packed, 3=Cayenne LPP dynamic, 4=Cayenne LPP packed
#define COUNTERMODE 0 // 0=cyclic, 1=cumulative, 2=cyclic confirmed
+5 -3
View File
@@ -68,9 +68,11 @@ void set_sendcycle(uint8_t val[]) {
}
void set_sleepcycle(uint8_t val[]) {
cfg.sleepcycle = val[0];
// swap byte order from msb to lsb, note: this is a platform dependent hack
uint16_t t = __builtin_bswap16(*(uint16_t *)(val));
cfg.sleepcycle = t;
ESP_LOGI(TAG, "Remote command: set sleep cycle to %d seconds",
cfg.sleepcycle * 2);
cfg.sleepcycle * 10);
}
void set_wifichancycle(uint8_t val[]) {
@@ -435,7 +437,7 @@ static const cmd_t table[] = {
{0x13, set_sensor, 2}, {0x14, set_payloadmask, 1},
{0x15, set_bme, 1}, {0x16, set_batt, 1},
{0x17, set_wifiscan, 1}, {0x18, set_enscount, 1},
{0x19, set_sleepcycle, 1}, {0x20, set_loadconfig, 0},
{0x19, set_sleepcycle, 2}, {0x20, set_loadconfig, 0},
{0x21, set_saveconfig, 0}, {0x80, get_config, 0},
{0x81, get_status, 0}, {0x83, get_batt, 0},
{0x84, get_gps, 0}, {0x85, get_bme, 0},