senddata restructured

This commit is contained in:
Klaus K Wilting 2018-07-14 23:38:43 +02:00
parent bb3f06bfc4
commit 2821bc60f3
3 changed files with 12 additions and 11 deletions

View File

@ -47,8 +47,8 @@ build_flags =
; otherwise device may crash in dense environments due to serial buffer overflow ; otherwise device may crash in dense environments due to serial buffer overflow
; ;
; -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_NONE ; -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_NONE
-DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_INFO ; -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_INFO
; -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
; -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_VERBOSE ; -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_VERBOSE
; ;
; override lora settings from LMiC library in lmic/config.h and use main.h instead ; override lora settings from LMiC library in lmic/config.h and use main.h instead

View File

@ -38,8 +38,7 @@ extern uint64_t uptimecounter;
extern int countermode, screensaver, adrmode, lorasf, txpower, rlim; extern int countermode, screensaver, adrmode, lorasf, txpower, rlim;
extern uint16_t macs_total, macs_wifi, macs_ble; // MAC counters extern uint16_t macs_total, macs_wifi, macs_ble; // MAC counters
extern std::set<uint16_t> macs; extern std::set<uint16_t> macs;
extern hw_timer_t extern hw_timer_t *channelSwitch, *sendCycle;
*channelSwitch; // hardware timer used for wifi channel switching
#ifdef HAS_GPS #ifdef HAS_GPS
extern gpsStatus_t gps_status; // struct for storing gps data extern gpsStatus_t gps_status; // struct for storing gps data

View File

@ -107,16 +107,18 @@ void set_rssi(uint8_t val) {
void set_sendcycle(uint8_t val) { void set_sendcycle(uint8_t val) {
cfg.sendcycle = val; cfg.sendcycle = val;
// update send cycle interrupt
timerAlarmWrite(sendCycle, cfg.sendcycle * 2 * 10000, true);
// reload interrupt after each trigger of channel switch cycle
ESP_LOGI(TAG, "Remote command: set payload send cycle to %d seconds", ESP_LOGI(TAG, "Remote command: set payload send cycle to %d seconds",
cfg.sendcycle * 2); cfg.sendcycle * 2);
}; };
void set_wifichancycle(uint8_t val) { void set_wifichancycle(uint8_t val) {
cfg.wifichancycle = val; cfg.wifichancycle = val;
// modify wifi channel rotation IRQ // update channel rotation interrupt
timerAlarmWrite( timerAlarmWrite(channelSwitch, cfg.wifichancycle * 10000, true);
channelSwitch, cfg.wifichancycle * 10000,
true); // reload interrupt after each trigger of channel switch cycle
ESP_LOGI(TAG, ESP_LOGI(TAG,
"Remote command: set Wifi channel switch interval to %.1f seconds", "Remote command: set Wifi channel switch interval to %.1f seconds",
cfg.wifichancycle / float(100)); cfg.wifichancycle / float(100));