| 234 | } // namespace |
| 235 | |
| 236 | void init() |
| 237 | { |
| 238 | /* |
| 239 | * If the transmit buffer is full then default behaviour when writing is to sit in a loop waiting for space. |
| 240 | * This slows the application significantly, and is generally a bad thing. |
| 241 | * |
| 242 | * There are several solutions to this: |
| 243 | * |
| 244 | * 1. Set a larger transmit buffer size |
| 245 | * 2. Turn off waiting on transmit buffer full (TxWait, on by default) |
| 246 | * |
| 247 | * If you're using the serial port for debugging, and don't want the application to stall then set a large transmit |
| 248 | * buffer size and turn TxWait off. Surplus characters won't be written, and you can detect this by checking the |
| 249 | * return value from HardwareSerial::write, etc. if it's important. |
| 250 | * |
| 251 | * The optimal way to output data to the serial port is to break up large transfers into chunks, and use a callback |
| 252 | * to refill the buffer when it becomes empty. This demo shows how that can be done for outputting a file. |
| 253 | */ |
| 254 | Serial.setTxBufferSize(2048); |
| 255 | Serial.setTxWait(false); |
| 256 | |
| 257 | Serial.begin(SERIAL_BAUD_RATE, SERIAL_8N1, SERIAL_FULL, serialPins[0].tx, serialPins[0].rx); |
| 258 | Serial.systemDebugOutput(true); |
| 259 | |
| 260 | // There's a large file on SPIFFS we'll be accessing later on |
| 261 | spiffs_mount(); |
| 262 | |
| 263 | /*There are four debug levels: debug=3, info=2, warn=1, error=0 |
| 264 | * You can set the debug level by making with DEBUG_VERBOSE_LEVEL |
| 265 | * set to the desired level (0-3). Ex make rebuild DEBUG_VERBOSE_LEVEL=2 will |
| 266 | * show only info messages and above, will not show debug messages |
| 267 | * (they will be removed from the build at compile time, saving flash space) |
| 268 | * |
| 269 | * Functions debugf, debug_d, debug_i, debug_w, and debug_e store the format string |
| 270 | * in flash so that the RAM is freed for more important information. |
| 271 | * |
| 272 | * Another useful feature is printing the filename and line number of every debug line |
| 273 | * This will require extra space on flash and can be enabled |
| 274 | * using make parameter PRINT_FILENAME_AND_LINE=1*/ |
| 275 | |
| 276 | debug_d("(DEBUG) message printed on UART0"); |
| 277 | |
| 278 | debug_i("(INFO) message printed on UART0"); |
| 279 | |
| 280 | debug_w("(WARNING) message printed on UART0"); |
| 281 | |
| 282 | debug_e("(ERROR) message printed on UART0"); |
| 283 | |
| 284 | /*debugf is equivalent to debug_i*/ |
| 285 | debugf("(INFO) message printed with debugf on UART0"); |
| 286 | |
| 287 | /* |
| 288 | * Notice: The line below disables the debugf output on all UARTs. |
| 289 | */ |
| 290 | Serial.systemDebugOutput(false); |
| 291 | |
| 292 | debugf("(DEBUG) don't print me at all"); |
| 293 |
nothing calls this directly
no test coverage detected