Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions UNOR4USBBridge/at_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,14 @@ CClientWrapper CAtHandler::getClient(int sock) {

/* -------------------------------------------------------------------------- */
void CAtHandler::run() {
/* -------------------------------------------------------------------------- */
at_srv.run();
vTaskDelay(1);
/* -------------------------------------------------------------------------- */
at_srv.run();
if (at_srv.desiredBaudrate > 0)
{
serial->begin(at_srv.desiredBaudrate, SERIAL_8N1, 6, 5);
at_srv.desiredBaudrate = -1;
}
vTaskDelay(1);
}


Expand Down
2 changes: 2 additions & 0 deletions UNOR4USBBridge/chAT.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ namespace SudoMaker::chAT {
void write_line_end();

RunStatus run();

int desiredBaudrate = -1; // Set this to a positive value to indicate UARD baud rate change is needed.
};

inline Server::RunStatus operator|(Server::RunStatus a, Server::RunStatus b) {
Expand Down
7 changes: 7 additions & 0 deletions UNOR4USBBridge/cmds_esp_generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ void CAtHandler::add_cmds_esp_generic() {
return chAT::CommandStatus::ERROR;
};

/* ....................................................................... */
command_table[_UART] = [this](auto & srv, auto & parser) {
/* ....................................................................... */
srv.desiredBaudrate = std::stoi(parser.args[0]);
return chAT::CommandStatus::OK;
};

/* ....................................................................... */
command_table[_RESTART_BOOTLOADER] = [this](auto & srv, auto & parser) {
/* ....................................................................... */
Expand Down
1 change: 1 addition & 0 deletions UNOR4USBBridge/commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ enum file_op {
#define _ENDL "\r\n"
#define _WIFISCAN "+WIFISCAN"

#define _UART "+UART"
#define _RESET "+RESET"
#define _RESTART_BOOTLOADER "+RESTARTBOOTLOADER"
#define _GMR "+GMR"
Expand Down