new rcommand 0x88 set_time
This commit is contained in:
parent
fcf2e4f59a
commit
b5314f1288
@ -579,10 +579,13 @@ Send for example `8386` as Downlink on Port 2 to get battery status and time/dat
|
||||
0x01 = timeNeedsSync (last sync failed)
|
||||
0x02 = timeSet (synched)
|
||||
|
||||
0x87 set time/date
|
||||
0x87 sync time/date
|
||||
|
||||
Device synchronizes it's time/date by calling the preconfigured time source.
|
||||
|
||||
0x88 set time/date
|
||||
|
||||
bytes 1..4 = time/date to set in UTC epoch seconds (LSB, e.g. https://www.epochconverter.com/hex)
|
||||
|
||||
# License
|
||||
|
||||
|
@ -21,7 +21,8 @@ void set_reset(uint8_t val[]) {
|
||||
reset_counters(); // clear macs
|
||||
break;
|
||||
case 2: // reset device to factory settings
|
||||
ESP_LOGI(TAG, "Remote command: reset device to factory settings and restart");
|
||||
ESP_LOGI(TAG,
|
||||
"Remote command: reset device to factory settings and restart");
|
||||
eraseConfig();
|
||||
do_reset(false);
|
||||
break;
|
||||
@ -381,11 +382,18 @@ void get_time(uint8_t val[]) {
|
||||
SendPayload(TIMEPORT);
|
||||
};
|
||||
|
||||
void set_time(uint8_t val[]) {
|
||||
void set_timesync(uint8_t val[]) {
|
||||
ESP_LOGI(TAG, "Remote command: timesync requested");
|
||||
setTimeSyncIRQ();
|
||||
};
|
||||
|
||||
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);
|
||||
setMyTime(t, 0, _unsynced);
|
||||
};
|
||||
|
||||
void set_flush(uint8_t val[]) {
|
||||
ESP_LOGI(TAG, "Remote command: flush");
|
||||
// does nothing
|
||||
@ -431,8 +439,8 @@ static const cmd_t table[] = {
|
||||
{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_time, 0},
|
||||
{0x99, set_flush, 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