add rcommand 0x0d set wakeupsync
This commit is contained in:
parent
1eac9ca02f
commit
e37dae601d
@ -91,6 +91,11 @@ Send for example `83` `86` as Downlink on Port 2 to get battery status and time/
|
||||
0 ... 255 duration for scanning a bluetooth advertising channel in seconds/100
|
||||
e.g. 8 -> each channel is scanned for 80 milliseconds [default]
|
||||
|
||||
#### 0x0D set wakeup sync window
|
||||
|
||||
bytes 1..2 = wakeup sync window size in seconds (MSB), 0..255 (0 = no wakuep sync)
|
||||
e.g. {0x02, 0x58} -> device adjusts it's wakeup time when it is +/- 5 minutes from top-of-hour [default = 0]
|
||||
|
||||
#### 0x0E set Bluetooth scanner
|
||||
|
||||
0 = disabled
|
||||
|
@ -64,6 +64,7 @@ typedef struct __attribute__((packed)) {
|
||||
int16_t rssilimit; // threshold for rssilimiter, negative value!
|
||||
uint8_t sendcycle; // payload send cycle [seconds/2]
|
||||
uint16_t sleepcycle; // sleep cycle [seconds/10]
|
||||
uint16_t wakesync; // time window [seconds] to sync wakeup on top-of-hour
|
||||
uint8_t wifichancycle; // wifi channel switch cycle [seconds/100]
|
||||
uint8_t blescantime; // BLE scan cycle duration [seconds]
|
||||
uint8_t blescan; // 0=disabled, 1=enabled
|
||||
|
@ -3,7 +3,6 @@
|
||||
#include "globals.h"
|
||||
#include "configmanager.h"
|
||||
|
||||
|
||||
// namespace for device runtime preferences
|
||||
#define DEVCONFIG "paxcntcfg"
|
||||
|
||||
@ -38,6 +37,7 @@ static void defaultConfig(configData_t *myconfig) {
|
||||
myconfig->rssilimit = RSSILIMIT; // threshold for rssilimiter, negative value!
|
||||
myconfig->sendcycle = SENDCYCLE; // payload send cycle [seconds/2]
|
||||
myconfig->sleepcycle = SLEEPCYCLE; // sleep cycle [seconds/10]
|
||||
myconfig->wakesync = SYNCWAKEUP; // wakeup sync window [seconds]
|
||||
myconfig->wifichancycle =
|
||||
WIFI_CHANNEL_SWITCH_INTERVAL; // wifi channel switch cycle [seconds/100]
|
||||
myconfig->blescantime =
|
||||
|
@ -2,7 +2,6 @@
|
||||
#include "globals.h"
|
||||
#include "rcommand.h"
|
||||
|
||||
|
||||
static QueueHandle_t RcmdQueue;
|
||||
TaskHandle_t rcmdTask;
|
||||
|
||||
@ -80,6 +79,12 @@ void set_sleepcycle(uint8_t val[]) {
|
||||
cfg.sleepcycle * 10);
|
||||
}
|
||||
|
||||
void set_wakesync(uint8_t val[]) {
|
||||
// swap byte order from msb to lsb, note: this is a platform dependent hack
|
||||
cfg.wakesync = __builtin_bswap16(*(uint16_t *)(val));
|
||||
ESP_LOGI(TAG, "Remote command: set wakesync to %hu seconds", cfg.wakesync);
|
||||
}
|
||||
|
||||
void set_wifichancycle(uint8_t val[]) {
|
||||
cfg.wifichancycle = val[0];
|
||||
libpax_counter_stop();
|
||||
@ -369,7 +374,7 @@ void set_timesync(uint8_t val[]) {
|
||||
void set_time(uint8_t val[]) {
|
||||
// swap byte order from msb to lsb, note: this is a platform dependent hack
|
||||
uint32_t t = __builtin_bswap32(*(uint32_t *)(val));
|
||||
ESP_LOGI(TAG, "Remote command: set time to %d", t);
|
||||
ESP_LOGI(TAG, "Remote command: set time to %lu", t);
|
||||
setMyTime(t, 0, _set);
|
||||
};
|
||||
|
||||
@ -399,17 +404,17 @@ static const cmd_t table[] = {
|
||||
{0x07, set_loraadr, 1}, {0x08, set_screensaver, 1},
|
||||
{0x09, set_reset, 1}, {0x0a, set_sendcycle, 1},
|
||||
{0x0b, set_wifichancycle, 1}, {0x0c, set_blescantime, 1},
|
||||
{0x0e, set_blescan, 1}, {0x0f, set_wifiant, 1},
|
||||
{0x10, set_rgblum, 1}, {0x13, set_sensor, 2},
|
||||
{0x14, set_payloadmask, 1}, {0x15, set_bme, 1},
|
||||
{0x16, set_batt, 1}, {0x17, set_wifiscan, 1},
|
||||
{0x18, set_flush, 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}, {0x86, get_time, 0},
|
||||
{0x87, set_timesync, 0}, {0x88, set_time, 4},
|
||||
{0x99, set_flush, 0}};
|
||||
{0x0d, set_wakesync, 2}, {0x0e, set_blescan, 1},
|
||||
{0x0f, set_wifiant, 1}, {0x10, set_rgblum, 1},
|
||||
{0x13, set_sensor, 2}, {0x14, set_payloadmask, 1},
|
||||
{0x15, set_bme, 1}, {0x16, set_batt, 1},
|
||||
{0x17, set_wifiscan, 1}, {0x18, set_flush, 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},
|
||||
{0x86, get_time, 0}, {0x87, set_timesync, 0},
|
||||
{0x88, set_time, 4}, {0x99, set_flush, 0}};
|
||||
|
||||
static const uint8_t cmdtablesize =
|
||||
sizeof(table) / sizeof(table[0]); // number of commands in command table
|
||||
|
Loading…
Reference in New Issue
Block a user