new cmd set payload sendcycle
This commit is contained in:
parent
10afaba7d5
commit
326e01ba51
@ -156,10 +156,10 @@ Note: all settings are stored in NVRAM and will be reloaded when device starts.
|
||||
1 = reset MAC counter to zero
|
||||
2 = reset device to factory settings
|
||||
|
||||
0x0A set Wifi scan cycle and payload transmit cycle
|
||||
0x0A set payload send cycle
|
||||
|
||||
0 ... 255 duration of a wifi scan cycle in seconds/2, after this payload is sent
|
||||
e.g. 120 -> 1 cycle runs for 240 seconds [default]
|
||||
0 ... 255 payload send cycle in seconds/2
|
||||
e.g. 120 -> payload is transmitted each 240 seconds [default]
|
||||
|
||||
0x0B set Wifi channel switch interval timer
|
||||
|
||||
|
@ -11,9 +11,9 @@
|
||||
|
||||
; ---> SELECT TARGET PLATFORM HERE! <---
|
||||
[platformio]
|
||||
env_default = heltec_wifi_lora_32
|
||||
;env_default = heltec_wifi_lora_32
|
||||
;env_default = ttgov1
|
||||
;env_default = ttgov2
|
||||
env_default = ttgov2
|
||||
;env_default = lopy
|
||||
;env_default = lopy4
|
||||
;env_default = lolin32lite_lora
|
||||
|
@ -25,7 +25,7 @@ void defaultConfig() {
|
||||
cfg.screenon = 1; // 0=disbaled, 1=enabled
|
||||
cfg.countermode = 0; // 0=cyclic, 1=cumulative, 2=cyclic confirmed
|
||||
cfg.rssilimit = 0; // threshold for rssilimiter, negative value!
|
||||
cfg.wifiscancycle = SEND_SECS; // wifi scan cycle [seconds/2]
|
||||
cfg.sendcycle = SEND_SECS; // payload send cycle [seconds/2]
|
||||
cfg.wifichancycle = WIFI_CHANNEL_SWITCH_INTERVAL; // wifi channel switch cycle [seconds/100]
|
||||
cfg.blescantime = BLESCANTIME; // BLE scan cycle duration [seconds]
|
||||
cfg.blescan = 1; // 0=disabled, 1=enabled
|
||||
@ -99,8 +99,8 @@ void saveConfig() {
|
||||
if( nvs_get_i8(my_handle, "countermode", &flash8) != ESP_OK || flash8 != cfg.countermode )
|
||||
nvs_set_i8(my_handle, "countermode", cfg.countermode);
|
||||
|
||||
if( nvs_get_i8(my_handle, "wifiscancycle", &flash8) != ESP_OK || flash8 != cfg.wifiscancycle )
|
||||
nvs_set_i8(my_handle, "wifiscancycle", cfg.wifiscancycle);
|
||||
if( nvs_get_i8(my_handle, "sendcycle", &flash8) != ESP_OK || flash8 != cfg.sendcycle )
|
||||
nvs_set_i8(my_handle, "sendcycle", cfg.sendcycle);
|
||||
|
||||
if( nvs_get_i8(my_handle, "wifichancycle", &flash8) != ESP_OK || flash8 != cfg.wifichancycle )
|
||||
nvs_set_i8(my_handle, "wifichancycle", cfg.wifichancycle);
|
||||
@ -220,11 +220,11 @@ void loadConfig() {
|
||||
saveConfig();
|
||||
}
|
||||
|
||||
if( nvs_get_i8(my_handle, "wifiscancycle", &flash8) == ESP_OK ) {
|
||||
cfg.wifiscancycle = flash8;
|
||||
ESP_LOGI(TAG, "wifiscancycle = %d", flash8);
|
||||
if( nvs_get_i8(my_handle, "sendcycle", &flash8) == ESP_OK ) {
|
||||
cfg.sendcycle = flash8;
|
||||
ESP_LOGI(TAG, "sendcycle = %d", flash8);
|
||||
} else {
|
||||
ESP_LOGI(TAG, "WIFI scan cycle set to default %d", cfg.wifiscancycle);
|
||||
ESP_LOGI(TAG, "Payload send cycle set to default %d", cfg.sendcycle);
|
||||
saveConfig();
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ typedef struct {
|
||||
int8_t screenon; // 0=disabled, 1=enabled
|
||||
int8_t countermode; // 0=cyclic unconfirmed, 1=cumulative, 2=cyclic confirmed
|
||||
int16_t rssilimit; // threshold for rssilimiter, negative value!
|
||||
int8_t wifiscancycle; // wifi scan cycle [seconds/2]
|
||||
int8_t sendcycle; // payload send cycle [seconds/2]
|
||||
int8_t wifichancycle; // wifi channel switch cycle [seconds/100]
|
||||
int8_t blescantime; // BLE scan cycle duration [seconds]
|
||||
int8_t blescan; // 0=disabled, 1=enabled
|
||||
|
@ -140,7 +140,7 @@ void do_send(osjob_t* j){
|
||||
}
|
||||
|
||||
// Schedule next transmission
|
||||
os_setTimedCallback(&sendjob, os_getTime()+sec2osticks(SEND_SECS * 2), do_send);
|
||||
os_setTimedCallback(&sendjob, os_getTime()+sec2osticks(cfg.sendcycle * 2), do_send);
|
||||
|
||||
} // do_send()
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
// program version - note: increment version after modifications to configData_t struct!!
|
||||
#define PROGVERSION "1.3.32" // use max 10 chars here!
|
||||
#define PROGVERSION "1.3.34" // use max 10 chars here!
|
||||
#define PROGNAME "PAXCNT"
|
||||
|
||||
//--- Declarations ---
|
||||
|
@ -77,9 +77,9 @@ void set_rssi(int val) {
|
||||
ESP_LOGI(TAG, "Remote command: set RSSI limit to %d", cfg.rssilimit);
|
||||
};
|
||||
|
||||
void set_wifiscancycle(int val) {
|
||||
cfg.wifiscancycle = val;
|
||||
ESP_LOGI(TAG, "Remote command: set Wifi scan cycle duration to %d seconds", cfg.wifiscancycle*2);
|
||||
void set_sendcycle(int val) {
|
||||
cfg.sendcycle = val;
|
||||
ESP_LOGI(TAG, "Remote command: set payload send cycle to %d seconds", cfg.sendcycle*2);
|
||||
};
|
||||
|
||||
void set_wifichancycle(int val) {
|
||||
@ -232,7 +232,7 @@ cmd_t table[] = {
|
||||
{0x07, set_loraadr, true},
|
||||
{0x08, set_screensaver, true},
|
||||
{0x09, set_reset, false},
|
||||
{0x0a, set_wifiscancycle, true},
|
||||
{0x0a, set_sendcycle, true},
|
||||
{0x0b, set_wifichancycle, true},
|
||||
{0x0c, set_blescantime, true},
|
||||
{0x0d, set_vendorfilter, false},
|
||||
|
Loading…
Reference in New Issue
Block a user