[FL-1472, FL-1596, FL-1673] IRDA: stability improvements (#655)

- Restrict with 31 bytes length for remote and signal name
- Don't stuck for 0 PWM cycle timings
- Support timings > 65535 PWM cycles
- Fix remote file open error
- Add IRDA TX debug redirect
- Add remote parse error print, improve parsing, support tabs
- Fix stucks with uncorrect RAW signal values, long strings in remote file, etc
- Fix HAL signals capturing (save previous read value)
- Fix leak in case of failed parsing
This commit is contained in:
Albert Kharisov
2021-08-19 03:18:42 +03:00
committed by GitHub
parent 9d38f28de7
commit 5f6aff2255
19 changed files with 347 additions and 177 deletions

View File

@@ -3,24 +3,31 @@
void IrdaAppSceneEditRename::on_enter(IrdaApp* app) {
IrdaAppViewManager* view_manager = app->get_view_manager();
TextInput* text_input = view_manager->get_text_input();
size_t enter_name_length = 0;
auto remote_manager = app->get_remote_manager();
if(app->get_edit_element() == IrdaApp::EditElement::Button) {
furi_assert(app->get_current_button() != IrdaApp::ButtonNA);
auto button_name = remote_manager->get_button_name(app->get_current_button());
strncpy(app->get_text_store(0), button_name.c_str(), app->get_text_store_size());
char* buffer_str = app->get_text_store(0);
size_t max_len = IrdaAppRemoteManager::max_button_name_length;
strncpy(buffer_str, button_name.c_str(), max_len);
buffer_str[max_len + 1] = 0;
enter_name_length = max_len;
text_input_set_header_text(text_input, "Name the key");
} else {
auto remote_name = remote_manager->get_remote_name();
strncpy(app->get_text_store(0), remote_name.c_str(), app->get_text_store_size());
enter_name_length = IrdaAppRemoteManager::max_remote_name_length;
text_input_set_header_text(text_input, "Name the remote");
}
text_input_set_header_text(text_input, "Name the key");
text_input_set_result_callback(
text_input,
IrdaApp::text_input_callback,
app,
app->get_text_store(0),
app->get_text_store_size(),
enter_name_length,
false);
view_manager->switch_to(IrdaAppViewManager::ViewType::TextInput);

View File

@@ -26,7 +26,7 @@ void IrdaAppSceneLearnEnterName::on_enter(IrdaApp* app) {
IrdaApp::text_input_callback,
app,
app->get_text_store(0),
app->get_text_store_size(),
IrdaAppRemoteManager::max_button_name_length,
false);
view_manager->switch_to(IrdaAppViewManager::ViewType::TextInput);