Skip to content

Commit

Permalink
[WIP baudrate autodetection]
Browse files Browse the repository at this point in the history
  • Loading branch information
andreagilardoni committed Jul 29, 2024
1 parent 9ce159f commit 2cdcca5
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions libraries/WiFiS3/src/Modem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,20 @@ void ModemClass::begin(int badurate){
/* -------------------------------------------------------------------------- */
if(_serial != nullptr && !beginned) {
_serial->begin(badurate);

if(_serial_debug && _debug_level >= 2) {
_serial_debug->println("Baudrate autodetection started");
}
// auto baudrate detection algorithm
do {
_serial->write(0x55);
// delay(1);
} while(!_serial->available() || _serial->read() != 0x55); // TODO put timeout

if(_serial_debug && _debug_level >= 2) {
_serial_debug->print("Baudrate autodetection terminated");
}

beginned = true;
string res = "";
_serial->flush();
Expand Down

0 comments on commit 2cdcca5

Please sign in to comment.