rcommand get time

This commit is contained in:
Klaus K Wilting 2019-02-24 13:35:40 +01:00
parent 7dd82eb5ee
commit c02b8bc751

View File

@ -68,7 +68,7 @@ void set_sendcycle(uint8_t val[]) {
void set_wifichancycle(uint8_t val[]) { void set_wifichancycle(uint8_t val[]) {
cfg.wifichancycle = val[0]; cfg.wifichancycle = val[0];
// update Wifi channel rotation timer period // update Wifi channel rotation timer period
xTimerChangePeriod(WifiChanTimer, pdMS_TO_TICKS(cfg.wifichancycle * 10), 100 ); xTimerChangePeriod(WifiChanTimer, pdMS_TO_TICKS(cfg.wifichancycle * 10), 100);
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",
@ -244,9 +244,8 @@ void get_status(uint8_t val[]) {
uint16_t voltage = 0; uint16_t voltage = 0;
#endif #endif
payload.reset(); payload.reset();
payload.addStatus(voltage, uptime() / 1000, temperatureRead(), payload.addStatus(voltage, uptime() / 1000, temperatureRead(), getFreeRAM(),
getFreeRAM(), rtc_get_reset_reason(0), rtc_get_reset_reason(0), rtc_get_reset_reason(1));
rtc_get_reset_reason(1));
SendPayload(STATUSPORT, prio_high); SendPayload(STATUSPORT, prio_high);
}; };
@ -273,6 +272,17 @@ void get_bme(uint8_t val[]) {
#endif #endif
}; };
void get_time(uint8_t val[]) {
ESP_LOGI(TAG, "Remote command: get time");
#ifdef HAS_BME
payload.reset();
payload.addtime(now());
SendPayload(TIMEPORT, prio_high);
#else
ESP_LOGW(TAG, "BME680 sensor not supported");
#endif
};
// assign previously defined functions to set of numeric remote commands // assign previously defined functions to set of numeric remote commands
// format: opcode, function, #bytes params, // format: opcode, function, #bytes params,
// flag (true = do make settings persistent / false = don't) // flag (true = do make settings persistent / false = don't)
@ -289,7 +299,7 @@ cmd_t table[] = {
{0x11, set_monitor, 1, true}, {0x12, set_beacon, 7, false}, {0x11, set_monitor, 1, true}, {0x12, set_beacon, 7, false},
{0x13, set_sensor, 2, true}, {0x80, get_config, 0, false}, {0x13, set_sensor, 2, true}, {0x80, get_config, 0, false},
{0x81, get_status, 0, false}, {0x84, get_gps, 0, false}, {0x81, get_status, 0, false}, {0x84, get_gps, 0, false},
{0x85, get_bme, 0, false}, {0x85, get_bme, 0, false}, {0x86, get_time, 0, false},
}; };
const uint8_t cmdtablesize = const uint8_t cmdtablesize =