Lua S.PORT push fixed

BT telemetry fix attempt, untested
This commit is contained in:
Bertrand Songis
2019-04-17 09:15:40 +02:00
parent b69b617a9f
commit 5e9ff2bea2
5 changed files with 15 additions and 9 deletions
+5 -3
View File
@@ -255,7 +255,6 @@ void bluetoothSendTrainer()
void bluetoothForwardTelemetry(const uint8_t * packet)
{
bluetoothBufferIndex = 0;
bluetoothCrc = 0x00;
bluetoothBuffer[bluetoothBufferIndex++] = START_STOP; // start byte
@@ -264,8 +263,11 @@ void bluetoothForwardTelemetry(const uint8_t * packet)
}
bluetoothBuffer[bluetoothBufferIndex++] = bluetoothCrc;
bluetoothBuffer[bluetoothBufferIndex++] = START_STOP; // end byte
bluetoothWrite(bluetoothBuffer, bluetoothBufferIndex);
bluetoothBufferIndex = 0;
if (bluetoothBufferIndex >= 2*FRSKY_SPORT_PACKET_SIZE) {
bluetoothWrite(bluetoothBuffer, bluetoothBufferIndex);
bluetoothBufferIndex = 0;
}
}
void bluetoothReceiveTrainer()
+2 -2
View File
@@ -333,8 +333,8 @@ PACK(struct TelemetrySensor {
};
union {
PACK(struct {
uint8_t physID:5; // instance ID to allow handling multiple instances of same value type, for FrSky can be the physical ID of the sensor
uint8_t rxIndex:3;
uint8_t physID:5;
uint8_t rxIndex:3; // 1 bit for module index, 2 bits for receiver index
}) frskyInstance;
uint8_t instance;
NOBACKUP(uint8_t formula);
@@ -51,7 +51,7 @@ void menuModelSensor(event_t event)
0, // Name
0, // Type
sensor->type == TELEM_TYPE_CALCULATED ? (uint8_t)0 : (uint8_t)1, // ID / Formula
sensor->type == TELEM_TYPE_CALCULATED ? HIDDEN_ROW : LABEL(Receiver), // Receiver name
(sensor->type == TELEM_TYPE_CALCULATED || sensor->frskyInstance.rxIndex == TELEMETRY_ENDPOINT_SPORT) ? HIDDEN_ROW : LABEL(Receiver), // Receiver name
((sensor->type == TELEM_TYPE_CALCULATED && (sensor->formula == TELEM_FORMULA_DIST)) || sensor->isConfigurable() ? (uint8_t)0 : HIDDEN_ROW), // Unit
(sensor->isPrecConfigurable() && sensor->unit != UNIT_FAHRENHEIT ? (uint8_t)0 : HIDDEN_ROW), // Precision
(sensor->unit >= UNIT_FIRST_VIRTUAL ? HIDDEN_ROW : (uint8_t)0), // Param1
@@ -144,10 +144,9 @@ void menuModelSensor(event_t event)
case SENSOR_FILED_RECEIVER_NAME:
lcdDrawTextAlignedLeft(y, STR_RECEIVER);
drawReceiverName(SENSOR_2ND_COLUMN, y, (sensor->instance >> 7) & 0x01, (sensor->instance >> 5) & 0x03, 0);
drawReceiverName(SENSOR_2ND_COLUMN, y, sensor->frskyInstance.rxIndex >> 2, sensor->frskyInstance.rxIndex & 0x03, 0);
break;
case SENSOR_FIELD_UNIT:
lcdDrawTextAlignedLeft(y, "Unit");
// TODO flash saving with editChoice where I copied those 2 lines?
+1 -1
View File
@@ -323,7 +323,7 @@ void Pxx2Pulses::setupFrame(uint8_t module)
setupShareMode(module);
break;
default:
if (outputTelemetryBuffer.destination == module) {
if (outputTelemetryBuffer.isModuleDestination(module)) {
setupTelemetryFrame(module);
outputTelemetryBuffer.reset();
}
+5
View File
@@ -171,6 +171,11 @@ class OutputTelemetryBuffer {
timeout = 200; /* 2s */
}
bool isModuleDestination(uint8_t module)
{
return destination != TELEMETRY_ENDPOINT_NONE && destination != TELEMETRY_ENDPOINT_SPORT && (destination >> 2) == module;
}
void per10ms()
{
if (timeout > 0) {