This commit is contained in:
Evan Broder 2026-09-23 00:48:15 +00:00 • committed by GitHub
commit 141397eeca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -4330,6 +4330,10 @@ void Transceiver::sendFrame(byte *frame, uint8_t sync, uint8_t bitLength) {
//delayMicroseconds(9565); //delayMicroseconds(9565);
//delay(80); //delay(80);
} }
// On single-core parts the WiFi and lwIP tasks can preempt us mid-frame and delay an edge
// enough to corrupt the frame, so we bump the priority until the last data bit.
const UBaseType_t priority = uxTaskPriorityGet(NULL);
vTaskPrioritySet(NULL, configMAX_PRIORITIES - 1);
// Depending on the bitness of the protocol we will be sending a different hwsync. // Depending on the bitness of the protocol we will be sending a different hwsync.
// 56-bit 2 pulses for the first frame and 7 for the repeats // 56-bit 2 pulses for the first frame and 7 for the repeats
// 80-bit 24 pulses for the first frame and 14 pulses for the repeats // 80-bit 24 pulses for the first frame and 14 pulses for the repeats
@ -4364,6 +4368,7 @@ void Transceiver::sendFrame(byte *frame, uint8_t sync, uint8_t bitLength) {
last_bit = 0; last_bit = 0;
} }
} }
vTaskPrioritySet(NULL, priority);
// End with a 0 no matter what. This accommodates the 56-bit protocol by telling the // End with a 0 no matter what. This accommodates the 56-bit protocol by telling the
// motor that there are no more follow on bits. // motor that there are no more follow on bits.
if(last_bit == 0) { if(last_bit == 0) {