From 652e875b913c9506eb7ccede224a41d5c5189e10 Mon Sep 17 00:00:00 2001 From: cyberman54 Date: Sat, 26 Nov 2022 22:02:49 +0100 Subject: [PATCH] add sleepcycle to config query result --- docs/payloadformat.md | 3 +-- docs/remotecontrol.md | 2 +- src/payload.cpp | 6 +++--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/docs/payloadformat.md b/docs/payloadformat.md index 1edcace5..5e4aae16 100644 --- a/docs/payloadformat.md +++ b/docs/payloadformat.md @@ -59,8 +59,7 @@ Hereafter described is the default *plain* format, which uses MSB bit numbering. byte 11: Bluetooth channel switch interval in seconds/100 (0..255) [default 10] byte 12: Bluetooth scanner status (1=on, 0=0ff) [default 1] byte 13: Wifi antenna switch (0=internal, 1=external) [default 0] - byte 14: 0 (reserved) - byte 15: RGB LED luminosity (0..100 %) [default 30] + bytes 14-15: Sleep cycle in seconds/10 (MSB) [default 0] byte 16: Payloadmask (Bitmask, 0..255, see rcommand 0x14) byte 17: 0 (reserved) bytes 18-28: Software version (ASCII format, terminating with zero) diff --git a/docs/remotecontrol.md b/docs/remotecontrol.md index cddb9719..b1faafc3 100644 --- a/docs/remotecontrol.md +++ b/docs/remotecontrol.md @@ -145,7 +145,7 @@ Send for example `83` `86` as Downlink on Port 2 to get battery status and time/ #### 0x19 set sleep cycle - bytes 1..2 = device sleep cycle in seconds/10 (MSB), 1 ... 255 + bytes 1..2 = device sleep cycle in seconds/10 (MSB), 0..65535 (0 = no sleep) e.g. {0x04, 0xB0} -> device sleeps 200 minutes after each send cycle [default = 0] #### 0x20 load device configuration diff --git a/src/payload.cpp b/src/payload.cpp index bd9977c0..d601f9f5 100644 --- a/src/payload.cpp +++ b/src/payload.cpp @@ -47,8 +47,8 @@ void PayloadConvert::addConfig(configData_t value) { buffer[cursor++] = value.blescantime; buffer[cursor++] = value.blescan; buffer[cursor++] = value.wifiant; - buffer[cursor++] = 0; // reserved - buffer[cursor++] = value.rgblum; + buffer[cursor++] = highByte(value.sleepcycle); + buffer[cursor++] = lowByte(value.sleepcycle); buffer[cursor++] = value.payloadmask; buffer[cursor++] = 0; // reserved memcpy(buffer + cursor, value.version, 10); @@ -171,7 +171,7 @@ void PayloadConvert::addConfig(configData_t value) { writeUint8(value.sendcycle); writeUint8(value.wifichancycle); writeUint8(value.blescantime); - writeUint8(value.rgblum); + writeUint16(value.sleepcycle); writeBitmap(value.adrmode ? true : false, value.screensaver ? true : false, value.screenon ? true : false, value.countermode ? true : false, value.blescan ? true : false, value.wifiant ? true : false, 0, 0);