mirror of
https://github.com/opentx/opentx.git
synced 2025-07-12 19:10:19 +03:00
POC for discussion
This commit is contained in:
parent
ed8773b7fd
commit
02b7191881
4 changed files with 6 additions and 7 deletions
|
@ -155,8 +155,7 @@ bool menuModelSensor(event_t event)
|
||||||
drawReceiverName(SENSOR_2ND_COLUMN, y, sensor->frskyInstance.rxIndex >> 2, sensor->frskyInstance.rxIndex & 0x03, 0);
|
drawReceiverName(SENSOR_2ND_COLUMN, y, sensor->frskyInstance.rxIndex >> 2, sensor->frskyInstance.rxIndex & 0x03, 0);
|
||||||
}
|
}
|
||||||
#if defined(HARDWARE_INTERNAL_MODULE)
|
#if defined(HARDWARE_INTERNAL_MODULE)
|
||||||
else if (isModuleUsingSport(INTERNAL_MODULE, g_model.moduleData[INTERNAL_MODULE].type)) {
|
else if ((sensor->frskyInstance.rxIndex >> 2) == INTERNAL_MODULE) {
|
||||||
// far from perfect
|
|
||||||
lcdDrawText(SENSOR_2ND_COLUMN, y, STR_INTERNAL_MODULE);
|
lcdDrawText(SENSOR_2ND_COLUMN, y, STR_INTERNAL_MODULE);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -52,7 +52,7 @@ const MLinkSensor * getMLinkSensor(uint16_t id)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void processMLinkPacket(const uint8_t * packet)
|
void processMLinkPacket(const uint8_t * packet, uint8_t module)
|
||||||
{
|
{
|
||||||
const uint8_t * data = packet + 2;
|
const uint8_t * data = packet + 2;
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ void processMLinkPacket(const uint8_t * packet)
|
||||||
for (uint8_t i = 1; i < 5; i += 3) { //2 sensors per packet
|
for (uint8_t i = 1; i < 5; i += 3) { //2 sensors per packet
|
||||||
int32_t val = (int16_t )(data[i + 2] << 8 | data[i + 1]);
|
int32_t val = (int16_t )(data[i + 2] << 8 | data[i + 1]);
|
||||||
val = val >> 1; // remove alarm flag
|
val = val >> 1; // remove alarm flag
|
||||||
uint8_t adress = (data[i] & 0xF0) >> 4;
|
uint8_t adress = ((data[i] & 0xF0) >> 4) + (module << 7);
|
||||||
switch (data[i] & 0x0F) {
|
switch (data[i] & 0x0F) {
|
||||||
case MLINK_VOLTAGE:
|
case MLINK_VOLTAGE:
|
||||||
if ((data[i] & 0xF0) == 0x00){
|
if ((data[i] & 0xF0) == 0x00){
|
||||||
|
@ -116,7 +116,7 @@ void processMLinkPacket(const uint8_t * packet)
|
||||||
break;
|
break;
|
||||||
case MLINK_LQI:
|
case MLINK_LQI:
|
||||||
uint8_t mlinkRssi = data[i + 1] >> 1;
|
uint8_t mlinkRssi = data[i + 1] >> 1;
|
||||||
setTelemetryValue(PROTOCOL_TELEMETRY_MLINK, MLINK_LQI, 0, 0, mlinkRssi, UNIT_RAW, 0);
|
setTelemetryValue(PROTOCOL_TELEMETRY_MLINK, MLINK_LQI , 0, module << 7, mlinkRssi, UNIT_RAW, 0);
|
||||||
telemetryData.rssi.set(mlinkRssi);
|
telemetryData.rssi.set(mlinkRssi);
|
||||||
if (mlinkRssi > 0) {
|
if (mlinkRssi > 0) {
|
||||||
telemetryStreaming = TELEMETRY_TIMEOUT10ms;
|
telemetryStreaming = TELEMETRY_TIMEOUT10ms;
|
||||||
|
|
|
@ -44,4 +44,4 @@ void processMLinkTelemetryData(uint8_t data, uint8_t* rxBuffer, uint8_t& rxBuffe
|
||||||
void mlinkSetDefault(int index, uint16_t id, uint8_t subId, uint8_t instance);
|
void mlinkSetDefault(int index, uint16_t id, uint8_t subId, uint8_t instance);
|
||||||
|
|
||||||
// Used by multi protocol
|
// Used by multi protocol
|
||||||
void processMLinkPacket(const uint8_t *packet);
|
void processMLinkPacket(const uint8_t *packet, uint8_t module);
|
||||||
|
|
|
@ -382,7 +382,7 @@ static void processMultiTelemetryPaket(const uint8_t * packet, uint8_t module)
|
||||||
|
|
||||||
case MLinkTelemetry:
|
case MLinkTelemetry:
|
||||||
if (len > 6)
|
if (len > 6)
|
||||||
processMLinkPacket(data);
|
processMLinkPacket(data, module);
|
||||||
else
|
else
|
||||||
TRACE("[MP] Received M-Link telemetry len %d < 6", len);
|
TRACE("[MP] Received M-Link telemetry len %d < 6", len);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue