[FL-1854] NEC42ext displaying (#796)
* Add correct key-reading asset * IRDA: correct NEC42ext displaying * IRDA App: correct vibro There are no double vibro, but 1 vibro for any successful new signal read, and 1 for sending just read signal. Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
@@ -211,10 +211,12 @@ void IrdaApp::notify_red_blink() {
|
||||
notification_message(notification, &sequence_blink_red_10);
|
||||
}
|
||||
|
||||
void IrdaApp::notify_space_blink() {
|
||||
void IrdaApp::notify_sent_just_learnt() {
|
||||
static const NotificationSequence sequence = {
|
||||
&message_green_0,
|
||||
&message_vibro_on,
|
||||
&message_delay_50,
|
||||
&message_vibro_off,
|
||||
&message_green_255,
|
||||
&message_do_not_reset,
|
||||
NULL,
|
||||
@@ -261,10 +263,6 @@ void IrdaApp::notify_blink_green() {
|
||||
notification_message(notification, &sequence);
|
||||
}
|
||||
|
||||
void IrdaApp::notify_double_vibro() {
|
||||
notification_message(notification, &sequence_double_vibro);
|
||||
}
|
||||
|
||||
void IrdaApp::notify_green_on() {
|
||||
notification_message(notification, &sequence_set_only_green_255);
|
||||
}
|
||||
|
@@ -77,8 +77,7 @@ public:
|
||||
|
||||
void notify_success();
|
||||
void notify_red_blink();
|
||||
void notify_space_blink();
|
||||
void notify_double_vibro();
|
||||
void notify_sent_just_learnt();
|
||||
void notify_green_on();
|
||||
void notify_green_off();
|
||||
void notify_click();
|
||||
|
@@ -23,16 +23,24 @@ void IrdaAppSceneLearnSuccess::on_enter(IrdaApp* app) {
|
||||
|
||||
if(!signal.is_raw()) {
|
||||
auto message = &signal.get_message();
|
||||
uint8_t adr_digits = ROUND_UP_TO(irda_get_protocol_address_length(message->protocol), 4);
|
||||
uint8_t cmd_digits = ROUND_UP_TO(irda_get_protocol_command_length(message->protocol), 4);
|
||||
uint8_t max_digits = MAX(adr_digits, cmd_digits);
|
||||
max_digits = MIN(max_digits, 7);
|
||||
size_t label_x_offset = 63 + (7 - max_digits) * 3;
|
||||
|
||||
app->set_text_store(0, "%s", irda_get_protocol_name(message->protocol));
|
||||
app->set_text_store(
|
||||
1,
|
||||
"A: 0x%0*lX\nC: 0x%0*lX\n",
|
||||
ROUND_UP_TO(irda_get_protocol_address_length(message->protocol), 4),
|
||||
adr_digits,
|
||||
message->address,
|
||||
ROUND_UP_TO(irda_get_protocol_command_length(message->protocol), 4),
|
||||
cmd_digits,
|
||||
message->command);
|
||||
dialog_ex_set_header(dialog_ex, app->get_text_store(0), 95, 10, AlignCenter, AlignCenter);
|
||||
dialog_ex_set_text(dialog_ex, app->get_text_store(1), 75, 23, AlignLeft, AlignTop);
|
||||
|
||||
dialog_ex_set_header(dialog_ex, app->get_text_store(0), 95, 7, AlignCenter, AlignCenter);
|
||||
dialog_ex_set_text(
|
||||
dialog_ex, app->get_text_store(1), label_x_offset, 34, AlignLeft, AlignCenter);
|
||||
} else {
|
||||
dialog_ex_set_header(dialog_ex, "Unknown", 95, 10, AlignCenter, AlignCenter);
|
||||
app->set_text_store(0, "%d samples", signal.get_raw_signal().timings_cnt);
|
||||
@@ -42,7 +50,7 @@ void IrdaAppSceneLearnSuccess::on_enter(IrdaApp* app) {
|
||||
dialog_ex_set_left_button_text(dialog_ex, "Retry");
|
||||
dialog_ex_set_right_button_text(dialog_ex, "Save");
|
||||
dialog_ex_set_center_button_text(dialog_ex, "Send");
|
||||
dialog_ex_set_icon(dialog_ex, 0, 1, &I_DolphinExcited_64x63);
|
||||
dialog_ex_set_icon(dialog_ex, 0, 1, &I_DolphinReadingSuccess_59x63);
|
||||
dialog_ex_set_result_callback(dialog_ex, dialog_result_callback);
|
||||
dialog_ex_set_context(dialog_ex, app);
|
||||
|
||||
@@ -62,7 +70,7 @@ bool IrdaAppSceneLearnSuccess::on_event(IrdaApp* app, IrdaAppEvent* event) {
|
||||
app->switch_to_next_scene_without_saving(IrdaApp::Scene::Learn);
|
||||
break;
|
||||
case DialogExResultCenter: {
|
||||
app->notify_space_blink();
|
||||
app->notify_sent_just_learnt();
|
||||
auto signal = app->get_received_signal();
|
||||
signal.transmit();
|
||||
break;
|
||||
|
@@ -39,10 +39,6 @@ void IrdaAppSceneLearn::on_enter(IrdaApp* app) {
|
||||
popup, "Point the remote at IR port\nand push the button", 5, 10, AlignLeft, AlignCenter);
|
||||
popup_set_callback(popup, NULL);
|
||||
|
||||
if(app->get_learn_new_remote()) {
|
||||
app->notify_double_vibro();
|
||||
}
|
||||
|
||||
view_manager->switch_to(IrdaAppViewManager::ViewType::Popup);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user