mirror of
https://github.com/meshtastic/firmware.git
synced 2025-08-23 21:40:14 +00:00
fixes after testing stream protocol with python client
This commit is contained in:
parent
88a704c4d3
commit
59086fd477
@ -9,7 +9,7 @@ SerialConsole console;
|
|||||||
SerialConsole::SerialConsole() : StreamAPI(&Port), RedirectablePrint(&Port)
|
SerialConsole::SerialConsole() : StreamAPI(&Port), RedirectablePrint(&Port)
|
||||||
{
|
{
|
||||||
canWrite = false; // We don't send packets to our port until it has talked to us first
|
canWrite = false; // We don't send packets to our port until it has talked to us first
|
||||||
// setDestination(&noopPrint);
|
// setDestination(&noopPrint); for testing, try turning off 'all' debug output and see what leaks
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Do late init that can't happen at constructor time
|
/// Do late init that can't happen at constructor time
|
||||||
@ -25,7 +25,7 @@ void SerialConsole::init()
|
|||||||
*/
|
*/
|
||||||
void SerialConsole::handleToRadio(const uint8_t *buf, size_t len)
|
void SerialConsole::handleToRadio(const uint8_t *buf, size_t len)
|
||||||
{
|
{
|
||||||
// Note: for the time being we _allow_ debug printing to keep going out the console
|
// Note: for the time being we could _allow_ debug printing to keep going out the console
|
||||||
// I _think_ this is okay because we currently only print debug msgs from loop() and we are only
|
// I _think_ this is okay because we currently only print debug msgs from loop() and we are only
|
||||||
// dispatching serial protobuf msgs from loop() as well. When things are more threaded in the future this
|
// dispatching serial protobuf msgs from loop() as well. When things are more threaded in the future this
|
||||||
// will need to change.
|
// will need to change.
|
||||||
|
@ -39,9 +39,10 @@ void StreamAPI::readStream()
|
|||||||
rxPtr = 0; // length is bogus, restart search for framing
|
rxPtr = 0; // length is bogus, restart search for framing
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rxPtr != 0 && ptr == len + HEADER_LEN) {
|
if (rxPtr != 0 && ptr + 1 == len + HEADER_LEN) {
|
||||||
// If we didn't just fail the packet and we now have the right # of bytes, parse it
|
// If we didn't just fail the packet and we now have the right # of bytes, parse it
|
||||||
handleToRadio(rxBuf + HEADER_LEN, len);
|
handleToRadio(rxBuf + HEADER_LEN, len);
|
||||||
|
rxPtr = 0; // start over again
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user