Merge pull request #960 from cyberman54/development
add wifi channel map configuration option
This commit is contained in:
commit
e05154a359
@ -111,6 +111,11 @@ Send for example `83` `86` as Downlink on Port 2 to get battery status and time/
|
||||
0 ... 100 percentage of luminosity (100% = full light)
|
||||
e.g. 50 -> 50% of luminosity [default]
|
||||
|
||||
#### 0x11 set Wifi scanner channel map bitmask
|
||||
|
||||
bytes 1..2 = wifi channel map bitmask (MSB), 0..8191
|
||||
e.g. 0b1010000001001 sets channels 1, 4, 11, 13
|
||||
|
||||
#### 0x13 set user sensor mode
|
||||
|
||||
byte 1 = user sensor number (1..3)
|
||||
|
@ -66,6 +66,7 @@ typedef struct __attribute__((packed)) {
|
||||
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]
|
||||
uint16_t wifichanmap; // wifi channel hopping scheme
|
||||
uint8_t blescantime; // BLE scan cycle duration [seconds]
|
||||
uint8_t blescan; // 0=disabled, 1=enabled
|
||||
uint8_t wifiscan; // 0=disabled, 1=enabled
|
||||
|
@ -60,7 +60,7 @@ upload_speed = 115200 ; set by build.py and taken from hal file
|
||||
lib_deps_lora =
|
||||
mcci-catena/MCCI LoRaWAN LMIC library @ ^4.1.1
|
||||
lib_deps_display =
|
||||
bitbank2/OneBitDisplay @ ^2.3.0
|
||||
bitbank2/OneBitDisplay @ ^2.3.1
|
||||
bitbank2/bb_spi_lcd @ ^2.4.1
|
||||
ricmoo/QRCode @ ^0.0.1
|
||||
lib_deps_ledmatrix =
|
||||
@ -70,7 +70,7 @@ lib_deps_rgbled =
|
||||
lib_deps_gps =
|
||||
mikalhart/TinyGPSPlus @ ^1.0.3
|
||||
lib_deps_sensors =
|
||||
adafruit/Adafruit Unified Sensor @ ^1.1.7
|
||||
adafruit/Adafruit Unified Sensor @ ^1.1.9
|
||||
adafruit/Adafruit BME280 Library @ ^2.2.2
|
||||
adafruit/Adafruit BMP085 Library @ ^1.2.2
|
||||
boschsensortec/BSEC Software Library @ 1.8.1492
|
||||
@ -78,7 +78,7 @@ lib_deps_sensors =
|
||||
lib_deps_basic =
|
||||
greyrook/libpax @ ^1.1.0
|
||||
https://github.com/SukkoPera/Arduino-Rokkit-Hash.git
|
||||
bblanchon/ArduinoJson @ ^6.20.1
|
||||
bblanchon/ArduinoJson @ ^6.21.2
|
||||
makuna/RTC @ ^2.3.7
|
||||
mathertel/OneButton @ ^2.0.3
|
||||
lewisxhe/XPowersLib @ ^0.1.5
|
||||
|
@ -27,7 +27,7 @@ lib_deps_all =
|
||||
fastled/FastLED @ ^3.5.0
|
||||
greyrook/libpax @ ^1.1.0
|
||||
https://github.com/SukkoPera/Arduino-Rokkit-Hash.git
|
||||
bblanchon/ArduinoJson @ ^6.20.1
|
||||
bblanchon/ArduinoJson @ ^6.21.2
|
||||
mathertel/OneButton @ ^2.0.3
|
||||
256dpi/MQTT @ ^2.5.1
|
||||
ricmoo/QRCode @ ^0.0.1
|
||||
|
@ -40,6 +40,7 @@ static void defaultConfig(configData_t *myconfig) {
|
||||
myconfig->wakesync = SYNCWAKEUP; // wakeup sync window [seconds]
|
||||
myconfig->wifichancycle =
|
||||
WIFI_CHANNEL_SWITCH_INTERVAL; // wifi channel switch cycle [seconds/100]
|
||||
myconfig->wifichanmap = WIFI_CHANNEL_MAP; // wifi channel hopping scheme
|
||||
myconfig->blescantime =
|
||||
BLESCANINTERVAL /
|
||||
10; // BT channel scan cycle [seconds/100], default 1 (= 10ms)
|
||||
|
@ -282,7 +282,7 @@ void setup() {
|
||||
// configure WIFI sniffing
|
||||
strcpy(configuration.wifi_my_country_str, WIFI_MY_COUNTRY);
|
||||
configuration.wificounter = cfg.wifiscan;
|
||||
configuration.wifi_channel_map = WIFI_CHANNEL_ALL;
|
||||
configuration.wifi_channel_map = cfg.wifichanmap;
|
||||
configuration.wifi_channel_switch_interval = cfg.wifichancycle;
|
||||
configuration.wifi_rssi_threshold = cfg.rssilimit;
|
||||
ESP_LOGI(TAG, "WIFISCAN: %s", cfg.wifiscan ? "on" : "off");
|
||||
|
@ -53,6 +53,7 @@
|
||||
// WiFi scan parameters
|
||||
#define WIFI_MY_COUNTRY "01" // select 2-letter locale for Wifi RF settings, e.g. "DE"; use "01" for world safe mode
|
||||
#define WIFI_CHANNEL_SWITCH_INTERVAL 50 // [seconds/100] -> 0,5 sec.
|
||||
#define WIFI_CHANNEL_MAP WIFI_CHANNEL_ALL // possible values see libpax_api.h
|
||||
|
||||
// LoRa payload default parameters
|
||||
#define MEM_LOW 2048 // [Bytes] low memory threshold triggering a send cycle
|
||||
|
@ -44,6 +44,7 @@ void PayloadConvert::addConfig(configData_t value) {
|
||||
buffer[cursor++] = lowByte(value.rssilimit);
|
||||
buffer[cursor++] = value.sendcycle;
|
||||
buffer[cursor++] = value.wifichancycle;
|
||||
//buffer[cursor++] = value.wifichanmap;
|
||||
buffer[cursor++] = value.blescantime;
|
||||
buffer[cursor++] = value.blescan;
|
||||
buffer[cursor++] = value.wifiant;
|
||||
@ -170,6 +171,7 @@ void PayloadConvert::addConfig(configData_t value) {
|
||||
writeUint16(value.rssilimit);
|
||||
writeUint8(value.sendcycle);
|
||||
writeUint8(value.wifichancycle);
|
||||
//writeUint8(value.wifichanmap);
|
||||
writeUint8(value.blescantime);
|
||||
writeUint16(value.sleepcycle);
|
||||
writeBitmap(value.adrmode ? true : false, value.screensaver ? true : false,
|
||||
|
@ -106,6 +106,17 @@ void set_wifichancycle(uint8_t val[]) {
|
||||
init_libpax();
|
||||
}
|
||||
|
||||
void set_wifichanmap(uint8_t val[]) {
|
||||
// swap byte order from msb to lsb, note: this is a platform dependent hack
|
||||
cfg.wifichanmap = __builtin_bswap16(*(uint16_t *)(val));
|
||||
libpax_counter_stop();
|
||||
libpax_config_t current_config;
|
||||
libpax_get_current_config(¤t_config);
|
||||
current_config.wifi_channel_map = cfg.wifichanmap;
|
||||
libpax_update_config(¤t_config);
|
||||
init_libpax();
|
||||
}
|
||||
|
||||
void set_blescantime(uint8_t val[]) {
|
||||
cfg.blescantime = val[0];
|
||||
libpax_counter_stop();
|
||||
@ -406,15 +417,16 @@ static const cmd_t table[] = {
|
||||
{0x0b, set_wifichancycle, 1}, {0x0c, set_blescantime, 1},
|
||||
{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}};
|
||||
{0x11, set_wifichanmap, 2}, {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