mirror of
https://github.com/opentx/opentx.git
synced 2025-07-25 17:25:13 +03:00
Options debug continued (not finished)
This commit is contained in:
parent
910298da58
commit
34a8e676d1
3 changed files with 33 additions and 11 deletions
|
@ -1933,10 +1933,12 @@ void menuModelReceiverOptions(event_t event)
|
||||||
drawReceiverName(FW * 13, 0, reusableBuffer.receiverSetup.receiverId);
|
drawReceiverName(FW * 13, 0, reusableBuffer.receiverSetup.receiverId);
|
||||||
lcdInvertLine(0);
|
lcdInvertLine(0);
|
||||||
|
|
||||||
if (event == EVT_ENTRY || (reusableBuffer.receiverSetup.state == 0x00 && get_tmr10ms() >= reusableBuffer.receiverSetup.updateTime)) {
|
if (event == EVT_ENTRY || (reusableBuffer.receiverSetup.state == 0xFF && get_tmr10ms() >= reusableBuffer.receiverSetup.updateTime)) {
|
||||||
reusableBuffer.receiverSetup.updateTime = get_tmr10ms() + 500/*5s*/;
|
reusableBuffer.receiverSetup.updateTime = get_tmr10ms() + 500/*5s*/;
|
||||||
reusableBuffer.receiverSetup.timeout = 0;
|
reusableBuffer.receiverSetup.timeout = 0;
|
||||||
|
reusableBuffer.receiverSetup.state = 0x00; // Get options
|
||||||
moduleSettings[reusableBuffer.receiverSetup.moduleIdx].mode = MODULE_MODE_RECEIVER_SETTINGS;
|
moduleSettings[reusableBuffer.receiverSetup.moduleIdx].mode = MODULE_MODE_RECEIVER_SETTINGS;
|
||||||
|
TRACE("GET polling");
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(SIMU)
|
#if defined(SIMU)
|
||||||
|
@ -1944,7 +1946,9 @@ void menuModelReceiverOptions(event_t event)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (reusableBuffer.receiverSetup.state != 0) {
|
if (reusableBuffer.receiverSetup.state != 0) {
|
||||||
|
bool changed = false;
|
||||||
for (uint8_t k=0; k<LCD_LINES-1; k++) {
|
for (uint8_t k=0; k<LCD_LINES-1; k++) {
|
||||||
|
uint8_t previousValue = 0;
|
||||||
coord_t y = MENU_HEADER_HEIGHT + 1 + k*FH;
|
coord_t y = MENU_HEADER_HEIGHT + 1 + k*FH;
|
||||||
uint8_t i = k + menuVerticalOffset;
|
uint8_t i = k + menuVerticalOffset;
|
||||||
LcdFlags attr = (sub==i ? (s_editMode>0 ? BLINK|INVERS : INVERS) : 0);
|
LcdFlags attr = (sub==i ? (s_editMode>0 ? BLINK|INVERS : INVERS) : 0);
|
||||||
|
@ -1954,10 +1958,19 @@ void menuModelReceiverOptions(event_t event)
|
||||||
|
|
||||||
switch (i) {
|
switch (i) {
|
||||||
case ITEM_RECEIVER_TELEMETRY:
|
case ITEM_RECEIVER_TELEMETRY:
|
||||||
reusableBuffer.receiverSetup.telemetryEnabled = editCheckBox(reusableBuffer.receiverSetup.telemetryEnabled , RECEIVER_OPTIONS_2ND_COLUMN, y, "Telemetry", attr, event);
|
previousValue = reusableBuffer.receiverSetup.telemetryEnabled;
|
||||||
|
reusableBuffer.receiverSetup.telemetryEnabled = editCheckBox(reusableBuffer.receiverSetup.telemetryEnabled, RECEIVER_OPTIONS_2ND_COLUMN, y,
|
||||||
|
"Telemetry", attr, event);
|
||||||
|
if (previousValue != reusableBuffer.receiverSetup.telemetryEnabled)
|
||||||
|
changed = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ITEM_RECEIVER_PWM_RATE:
|
case ITEM_RECEIVER_PWM_RATE:
|
||||||
reusableBuffer.receiverSetup.pwmRate = editCheckBox(reusableBuffer.receiverSetup.pwmRate , RECEIVER_OPTIONS_2ND_COLUMN, y, "9ms PWM", attr, event);
|
previousValue = reusableBuffer.receiverSetup.pwmRate;
|
||||||
|
reusableBuffer.receiverSetup.pwmRate = editCheckBox(reusableBuffer.receiverSetup.pwmRate, RECEIVER_OPTIONS_2ND_COLUMN, y, "9ms PWM", attr, event);
|
||||||
|
if (previousValue != reusableBuffer.receiverSetup.telemetryEnabled)
|
||||||
|
changed = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -1971,8 +1984,7 @@ void menuModelReceiverOptions(event_t event)
|
||||||
channel = checkIncDec(event, channel, 0, sentModuleChannels(g_moduleIdx));
|
channel = checkIncDec(event, channel, 0, sentModuleChannels(g_moduleIdx));
|
||||||
if (checkIncDec_Ret) {
|
if (checkIncDec_Ret) {
|
||||||
reusableBuffer.receiverSetup.channelMapping[pin] = channel;
|
reusableBuffer.receiverSetup.channelMapping[pin] = channel;
|
||||||
reusableBuffer.receiverSetup.state = 0x40;
|
changed = true;
|
||||||
moduleSettings[reusableBuffer.receiverSetup.moduleIdx].mode = MODULE_MODE_RECEIVER_SETTINGS;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1989,6 +2001,12 @@ void menuModelReceiverOptions(event_t event)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (changed) {
|
||||||
|
reusableBuffer.receiverSetup.state = 0x40; // Set options
|
||||||
|
reusableBuffer.receiverSetup.timeout = 0;
|
||||||
|
moduleSettings[reusableBuffer.receiverSetup.moduleIdx].mode = MODULE_MODE_RECEIVER_SETTINGS;
|
||||||
|
TRACE("CHange detected, sending SET");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
lcdDrawText(4 * FW, 4 * FH, "Waiting for RX...");
|
lcdDrawText(4 * FW, 4 * FH, "Waiting for RX...");
|
||||||
|
|
|
@ -147,11 +147,13 @@ void Pxx2Pulses::setupReceiverSettingsFrame(uint8_t module)
|
||||||
if (reusableBuffer.receiverSetup.timeout) {
|
if (reusableBuffer.receiverSetup.timeout) {
|
||||||
if (get_tmr10ms() > reusableBuffer.receiverSetup.timeout) {
|
if (get_tmr10ms() > reusableBuffer.receiverSetup.timeout) {
|
||||||
reusableBuffer.receiverSetup.timeout = 0;
|
reusableBuffer.receiverSetup.timeout = 0;
|
||||||
|
reusableBuffer.receiverSetup.state = 0xFF;
|
||||||
moduleSettings[module].mode = MODULE_MODE_NORMAL;
|
moduleSettings[module].mode = MODULE_MODE_NORMAL;
|
||||||
}
|
}
|
||||||
setupChannelsFrame(module);
|
setupChannelsFrame(module);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
TRACE("Frame is %d", reusableBuffer.receiverSetup.state);
|
||||||
addFrameType(PXX2_TYPE_C_MODULE, PXX2_TYPE_ID_RX_SETTINGS);
|
addFrameType(PXX2_TYPE_C_MODULE, PXX2_TYPE_ID_RX_SETTINGS);
|
||||||
Pxx2Transport::addByte(reusableBuffer.receiverSetup.state + reusableBuffer.receiverSetup.receiverId);
|
Pxx2Transport::addByte(reusableBuffer.receiverSetup.state + reusableBuffer.receiverSetup.receiverId);
|
||||||
uint8_t flag1 = 0;
|
uint8_t flag1 = 0;
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <opentx.h>
|
||||||
#include "opentx.h"
|
#include "opentx.h"
|
||||||
|
|
||||||
class Pxx2Telemetry
|
class Pxx2Telemetry
|
||||||
|
@ -64,13 +65,14 @@ void processReceiverSettingsFrame(uint8_t module, uint8_t * frame)
|
||||||
if (moduleSettings[module].mode != MODULE_MODE_RECEIVER_SETTINGS) {
|
if (moduleSettings[module].mode != MODULE_MODE_RECEIVER_SETTINGS) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
TRACE("Processing Frame");
|
||||||
for (uint8_t pin=0; pin<24; pin++) {
|
if (reusableBuffer.receiverSetup.state == 0x00) {
|
||||||
reusableBuffer.receiverSetup.channelMapping[pin] = frame[5 + pin];
|
TRACE("Frame is GET");
|
||||||
|
for (uint8_t pin = 0; pin < 24; pin++) {
|
||||||
|
reusableBuffer.receiverSetup.channelMapping[pin] = frame[5 + pin];
|
||||||
|
}
|
||||||
|
reusableBuffer.receiverSetup.pwmRate = frame[4] & 0x30;
|
||||||
}
|
}
|
||||||
|
|
||||||
reusableBuffer.receiverSetup.pwmRate = frame[4] & 0x30;
|
|
||||||
|
|
||||||
reusableBuffer.receiverSetup.state = 0xFF;
|
reusableBuffer.receiverSetup.state = 0xFF;
|
||||||
moduleSettings[module].mode = MODULE_MODE_NORMAL;
|
moduleSettings[module].mode = MODULE_MODE_NORMAL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue