ESP8266-based WiFi serial modem emulator ROM
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Serial: Use automatic baud rate detection after seeing DTR

+30
+19
serial.cpp
··· 83 83 return Serial.peek(); 84 84 } 85 85 86 + long 87 + serial_autobaud(void) 88 + { 89 + Serial.begin(115200); 90 + 91 + unsigned long baud = Serial.detectBaudrate(30000); 92 + if (baud) 93 + syslog.logf(LOG_INFO, "auto-detected baud rate of %lu", baud); 94 + else { 95 + syslog.logf(LOG_INFO, "couldn't auto-detect baud rate, " 96 + "using %d", settings->baud); 97 + baud = settings->baud; 98 + } 99 + 100 + Serial.begin(baud); 101 + 102 + return baud; 103 + } 104 + 86 105 /* Clear to Send */ 87 106 void 88 107 serial_cts(bool clear)
+1
wifippp.h
··· 87 87 int16_t serial_peek(void); 88 88 void serial_write(char b); 89 89 void serial_flush(void); 90 + long serial_autobaud(void); 90 91 void serial_cts(bool clear); 91 92 void serial_dcd(bool carrier); 92 93 void serial_dsr(bool ready);
+10
wifippp.ino
··· 36 36 37 37 switch (state) { 38 38 case STATE_AT: 39 + if (!serial_dtr()) { 40 + dtr = false; 41 + return; 42 + } 43 + 44 + if (!dtr) { 45 + serial_autobaud(); 46 + dtr = true; 47 + } 48 + 39 49 if (serial_available() && (b = serial_read())) 40 50 serial_alive = true; 41 51 else