modem debugging work in progress

This commit is contained in:
2023-06-06 17:36:36 +02:00
parent 2ded13f195
commit fe2e286c45
7 changed files with 42 additions and 3 deletions
@@ -141,6 +141,7 @@ public:
int write(uint8_t *data, size_t len) override
{
ESP_LOGI("TAG", "%zd %.*s", len, len, (const char *)data);
return cmux->write(instance, data, len);
}
void set_read_cb(std::function<bool(uint8_t *data, size_t len)> f) override
@@ -67,26 +67,35 @@ public:
{
if (mode == modem_mode::DATA_MODE) {
if (set_data_mode() != command_result::OK) {
return resume_data_mode() == command_result::OK;
const auto result = resume_data_mode() == command_result::OK;
ESP_LOGI("TAG", "result = %s", result?"true":"false");
return result;
}
ESP_LOGI("TAG", "result OK");
return true;
} else if (mode == modem_mode::COMMAND_MODE) {
Task::Delay(1000); // Mandatory 1s pause before
int retry = 0;
while (retry++ < 3) {
if (set_command_mode() == command_result::OK) {
ESP_LOGI("TAG", "result OK");
return true;
}
Task::Delay(1000); // Mandatory 1s pause after escape
if (sync() == command_result::OK) {
ESP_LOGI("TAG", "result OK");
return true;
}
Task::Delay(1000); // Mandatory 1s pause before escape
}
ESP_LOGI("TAG", "result NOT OK");
return false;
} else if (mode == modem_mode::CMUX_MODE) {
return set_cmux() == command_result::OK;
const auto result = set_cmux() == command_result::OK;
ESP_LOGI("TAG", "result = %s", result?"true":"false");
return result;
}
ESP_LOGI("TAG", "result OK");
return true;
}