mirror of
https://github.com/opentx/opentx.git
synced 2025-07-20 06:45:10 +03:00
Simplification
This commit is contained in:
parent
506fc8039f
commit
a11dbdf2cb
4 changed files with 23 additions and 32 deletions
|
@ -143,7 +143,7 @@ void menuRadioModulesVersion(event_t event)
|
||||||
// Module model
|
// Module model
|
||||||
if (y >= MENU_BODY_TOP && y < MENU_BODY_BOTTOM) {
|
if (y >= MENU_BODY_TOP && y < MENU_BODY_BOTTOM) {
|
||||||
lcdDrawText(INDENT_WIDTH, y, "Model");
|
lcdDrawText(INDENT_WIDTH, y, "Model");
|
||||||
uint8_t modelId = reusableBuffer.hardware.modules[module].modelID;
|
uint8_t modelId = reusableBuffer.hardware.modules[module].information.modelID;
|
||||||
if (modelId >= DIM(modulesModels))
|
if (modelId >= DIM(modulesModels))
|
||||||
modelId = 0;
|
modelId = 0;
|
||||||
lcdDrawText(12 * FW, y, modulesModels[modelId]);
|
lcdDrawText(12 * FW, y, modulesModels[modelId]);
|
||||||
|
@ -153,19 +153,19 @@ void menuRadioModulesVersion(event_t event)
|
||||||
// Module version
|
// Module version
|
||||||
if (y >= MENU_BODY_TOP && y < MENU_BODY_BOTTOM) {
|
if (y >= MENU_BODY_TOP && y < MENU_BODY_BOTTOM) {
|
||||||
lcdDrawText(INDENT_WIDTH, y, "Version");
|
lcdDrawText(INDENT_WIDTH, y, "Version");
|
||||||
if (reusableBuffer.hardware.modules[module].hwVersion.data) {
|
if (reusableBuffer.hardware.modules[module].information.modelID) {
|
||||||
drawPXX2FullVersion(12 * FW, y, reusableBuffer.hardware.modules[module].hwVersion, reusableBuffer.hardware.modules[module].swVersion);
|
drawPXX2FullVersion(12 * FW, y, reusableBuffer.hardware.modules[module].information.hwVersion, reusableBuffer.hardware.modules[module].information.swVersion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
y += FH;
|
y += FH;
|
||||||
|
|
||||||
for (uint8_t receiver=0; receiver<PXX2_MAX_RECEIVERS_PER_MODULE; receiver++) {
|
for (uint8_t receiver=0; receiver<PXX2_MAX_RECEIVERS_PER_MODULE; receiver++) {
|
||||||
if (reusableBuffer.hardware.modules[module].receivers[receiver].modelID) {
|
if (reusableBuffer.hardware.modules[module].receivers[receiver].information.modelID) {
|
||||||
// Receiver model
|
// Receiver model
|
||||||
if (y >= MENU_BODY_TOP && y < MENU_BODY_BOTTOM) {
|
if (y >= MENU_BODY_TOP && y < MENU_BODY_BOTTOM) {
|
||||||
lcdDrawText(INDENT_WIDTH, y, "Receiver");
|
lcdDrawText(INDENT_WIDTH, y, "Receiver");
|
||||||
lcdDrawNumber(lcdLastRightPos + 2, y, receiver + 1);
|
lcdDrawNumber(lcdLastRightPos + 2, y, receiver + 1);
|
||||||
uint8_t modelId = reusableBuffer.hardware.modules[module].receivers[receiver].modelID;
|
uint8_t modelId = reusableBuffer.hardware.modules[module].receivers[receiver].information.modelID;
|
||||||
if (modelId >= DIM(receiversModels))
|
if (modelId >= DIM(receiversModels))
|
||||||
modelId = 0;
|
modelId = 0;
|
||||||
lcdDrawText(12 * FW, y, receiversModels[modelId]);
|
lcdDrawText(12 * FW, y, receiversModels[modelId]);
|
||||||
|
@ -174,7 +174,7 @@ void menuRadioModulesVersion(event_t event)
|
||||||
|
|
||||||
// Receiver version
|
// Receiver version
|
||||||
if (y >= MENU_BODY_TOP && y < MENU_BODY_BOTTOM) {
|
if (y >= MENU_BODY_TOP && y < MENU_BODY_BOTTOM) {
|
||||||
drawPXX2FullVersion(12 * FW, y, reusableBuffer.hardware.modules[module].receivers[receiver].hwVersion, reusableBuffer.hardware.modules[module].receivers[receiver].swVersion);
|
drawPXX2FullVersion(12 * FW, y, reusableBuffer.hardware.modules[module].receivers[receiver].information.hwVersion, reusableBuffer.hardware.modules[module].receivers[receiver].information.swVersion);
|
||||||
}
|
}
|
||||||
y += FH;
|
y += FH;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1190,15 +1190,9 @@ union ReusableBuffer
|
||||||
struct {
|
struct {
|
||||||
int8_t step;
|
int8_t step;
|
||||||
uint8_t timeout;
|
uint8_t timeout;
|
||||||
uint8_t modelID;
|
PXX2HardwareInformation information;
|
||||||
PXX2Version hwVersion;
|
|
||||||
PXX2Version swVersion;
|
|
||||||
uint8_t variant;
|
|
||||||
struct {
|
struct {
|
||||||
uint8_t modelID;
|
PXX2HardwareInformation information;
|
||||||
PXX2Version hwVersion;
|
|
||||||
PXX2Version swVersion;
|
|
||||||
uint8_t variant;
|
|
||||||
} receivers[PXX2_MAX_RECEIVERS_PER_MODULE];
|
} receivers[PXX2_MAX_RECEIVERS_PER_MODULE];
|
||||||
} modules[NUM_MODULES];
|
} modules[NUM_MODULES];
|
||||||
uint32_t updateTime;
|
uint32_t updateTime;
|
||||||
|
|
|
@ -203,12 +203,17 @@ class Pxx2Pulses: public PxxPulses<Pxx2Transport> {
|
||||||
|
|
||||||
union PXX2Version
|
union PXX2Version
|
||||||
{
|
{
|
||||||
uint16_t data;
|
|
||||||
struct {
|
|
||||||
uint8_t major;
|
uint8_t major;
|
||||||
uint8_t minor:4;
|
uint8_t minor:4;
|
||||||
uint8_t revision:4;
|
uint8_t revision:4;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct PXX2HardwareInformation
|
||||||
|
{
|
||||||
|
uint8_t modelID;
|
||||||
|
PXX2Version hwVersion;
|
||||||
|
PXX2Version swVersion;
|
||||||
|
uint8_t variant;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -50,18 +50,10 @@ void processGetHardwareInfoFrame(uint8_t module, uint8_t * frame)
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t index = frame[3];
|
uint8_t index = frame[3];
|
||||||
if (index == 0xFF) {
|
if (index == 0xFF)
|
||||||
reusableBuffer.hardware.modules[module].modelID = frame[4];
|
memcpy(&reusableBuffer.hardware.modules[module].information, &frame[4], sizeof(PXX2HardwareInformation));
|
||||||
reusableBuffer.hardware.modules[module].hwVersion.data = *((uint16_t *)&frame[5]);
|
else if (index < PXX2_MAX_RECEIVERS_PER_MODULE)
|
||||||
reusableBuffer.hardware.modules[module].swVersion.data = *((uint16_t *)&frame[7]);
|
memcpy(&reusableBuffer.hardware.modules[module].receivers[index].information, &frame[4], sizeof(PXX2HardwareInformation));
|
||||||
reusableBuffer.hardware.modules[module].variant = frame[9];
|
|
||||||
}
|
|
||||||
else if (index < PXX2_MAX_RECEIVERS_PER_MODULE) {
|
|
||||||
reusableBuffer.hardware.modules[module].receivers[index].modelID = frame[4];
|
|
||||||
reusableBuffer.hardware.modules[module].receivers[index].hwVersion.data = *((uint16_t *)&frame[5]);
|
|
||||||
reusableBuffer.hardware.modules[module].receivers[index].swVersion.data = *((uint16_t *)&frame[7]);
|
|
||||||
reusableBuffer.hardware.modules[module].receivers[index].variant = frame[9];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void processModuleSettingsFrame(uint8_t module, uint8_t * frame)
|
void processModuleSettingsFrame(uint8_t module, uint8_t * frame)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue