Skip to content

Commit 27c050a

Browse files
[WIP baudrate autodetection]
1 parent 61eaaaa commit 27c050a

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

libraries/WiFiS3/src/Modem.cpp

+14
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,20 @@ void ModemClass::begin(int badurate){
3434
/* -------------------------------------------------------------------------- */
3535
if(_serial != nullptr && !beginned) {
3636
_serial->begin(badurate);
37+
38+
if(_serial_debug && _debug_level >= 2) {
39+
_serial_debug->println("Baudrate autodetection started");
40+
}
41+
// auto baudrate detection algorithm
42+
do {
43+
_serial->write(0x55);
44+
// delay(1);
45+
} while(!_serial->available() || _serial->read() != 0x55); // TODO put timeout
46+
47+
if(_serial_debug && _debug_level >= 2) {
48+
_serial_debug->print("Baudrate autodetection terminated");
49+
}
50+
3751
beginned = true;
3852
string res = "";
3953
_serial->flush();

0 commit comments

Comments
 (0)