|
@@ -16,13 +16,6 @@ struct XRemoteView {
|
|
|
void *context;
|
|
void *context;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-const NotificationSequence g_sequence_blink_purple_50 = {
|
|
|
|
|
- &message_red_255,
|
|
|
|
|
- &message_blue_255,
|
|
|
|
|
- &message_delay_50,
|
|
|
|
|
- NULL,
|
|
|
|
|
-};
|
|
|
|
|
-
|
|
|
|
|
XRemoteView* xremote_view_alloc(void* app_ctx, ViewInputCallback input_cb, ViewDrawCallback draw_cb)
|
|
XRemoteView* xremote_view_alloc(void* app_ctx, ViewInputCallback input_cb, ViewDrawCallback draw_cb)
|
|
|
{
|
|
{
|
|
|
XRemoteView* remote_view = malloc(sizeof(XRemoteView));
|
|
XRemoteView* remote_view = malloc(sizeof(XRemoteView));
|
|
@@ -95,33 +88,24 @@ InfraredRemoteButton* xremote_view_get_button_by_name(XRemoteView *rview, const
|
|
|
return infrared_remote_get_button_by_name(remote, name);
|
|
return infrared_remote_get_button_by_name(remote, name);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-bool xremote_view_send_ir_by_name(XRemoteView *rview, const char *name)
|
|
|
|
|
|
|
+bool xremote_view_press_button(XRemoteView *rview, InfraredRemoteButton* button)
|
|
|
{
|
|
{
|
|
|
- InfraredRemoteButton* button = xremote_view_get_button_by_name(rview, name);
|
|
|
|
|
xremote_app_assert(button, false);
|
|
xremote_app_assert(button, false);
|
|
|
|
|
+ XRemoteAppSettings* settings = rview->app_ctx->app_settings;
|
|
|
|
|
|
|
|
InfraredSignal* signal = infrared_remote_button_get_signal(button);
|
|
InfraredSignal* signal = infrared_remote_button_get_signal(button);
|
|
|
xremote_app_assert(signal, false);
|
|
xremote_app_assert(signal, false);
|
|
|
|
|
|
|
|
- infrared_signal_transmit(signal);
|
|
|
|
|
- NotificationApp* notifications = rview->app_ctx->notifications;
|
|
|
|
|
- notification_message(notifications, &g_sequence_blink_purple_50);
|
|
|
|
|
|
|
+ infrared_signal_transmit_times(signal, settings->repeat_count);
|
|
|
|
|
+ xremote_app_context_notify_led(rview->app_ctx);
|
|
|
|
|
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-bool xremote_view_press_button(XRemoteView *rview, InfraredRemoteButton* button)
|
|
|
|
|
|
|
+bool xremote_view_send_ir_msg_by_name(XRemoteView *rview, const char *name)
|
|
|
{
|
|
{
|
|
|
- xremote_app_assert(button, false);
|
|
|
|
|
-
|
|
|
|
|
- InfraredSignal* signal = infrared_remote_button_get_signal(button);
|
|
|
|
|
- xremote_app_assert(signal, false);
|
|
|
|
|
-
|
|
|
|
|
- infrared_signal_transmit(signal);
|
|
|
|
|
- NotificationApp* notifications = rview->app_ctx->notifications;
|
|
|
|
|
- notification_message(notifications, &g_sequence_blink_purple_50);
|
|
|
|
|
-
|
|
|
|
|
- return true;
|
|
|
|
|
|
|
+ InfraredRemoteButton* button = xremote_view_get_button_by_name(rview, name);
|
|
|
|
|
+ return (button != NULL) ? xremote_view_press_button(rview, button) : false;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void xremote_canvas_draw_icon(Canvas* canvas, uint8_t x, uint8_t y, XRemoteIcon icon)
|
|
void xremote_canvas_draw_icon(Canvas* canvas, uint8_t x, uint8_t y, XRemoteIcon icon)
|
|
@@ -241,7 +225,8 @@ void xremote_canvas_draw_exit_footer(Canvas* canvas, ViewOrientation orient, con
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
|
- xremote_canvas_draw_icon(canvas, 71, 60, XRemoteIconBack);
|
|
|
|
|
|
|
+ uint8_t x = strncmp(text, "Hold", 4) ? 71 : 76;
|
|
|
|
|
+ xremote_canvas_draw_icon(canvas, x, 60, XRemoteIconBack);
|
|
|
elements_multiline_text_aligned(canvas, 128, 64, AlignRight, AlignBottom, text);
|
|
elements_multiline_text_aligned(canvas, 128, 64, AlignRight, AlignBottom, text);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -276,7 +261,6 @@ void xremote_canvas_draw_button_png(Canvas* canvas, bool pressed, uint8_t x, uin
|
|
|
|
|
|
|
|
void xremote_canvas_draw_button_wide(Canvas* canvas, bool pressed, uint8_t x, uint8_t y, char* text, XRemoteIcon icon)
|
|
void xremote_canvas_draw_button_wide(Canvas* canvas, bool pressed, uint8_t x, uint8_t y, char* text, XRemoteIcon icon)
|
|
|
{
|
|
{
|
|
|
- (void)icon;
|
|
|
|
|
elements_slightly_rounded_frame(canvas, x + 4, y, 56, 15);
|
|
elements_slightly_rounded_frame(canvas, x + 4, y, 56, 15);
|
|
|
|
|
|
|
|
if (pressed)
|
|
if (pressed)
|
|
@@ -292,7 +276,6 @@ void xremote_canvas_draw_button_wide(Canvas* canvas, bool pressed, uint8_t x, ui
|
|
|
|
|
|
|
|
void xremote_canvas_draw_button_size(Canvas* canvas, bool pressed, uint8_t x, uint8_t y, uint8_t xy, char* text, XRemoteIcon icon)
|
|
void xremote_canvas_draw_button_size(Canvas* canvas, bool pressed, uint8_t x, uint8_t y, uint8_t xy, char* text, XRemoteIcon icon)
|
|
|
{
|
|
{
|
|
|
- (void)icon;
|
|
|
|
|
elements_slightly_rounded_frame(canvas, x + 4, y, xy, 15);
|
|
elements_slightly_rounded_frame(canvas, x + 4, y, xy, 15);
|
|
|
|
|
|
|
|
if (pressed)
|
|
if (pressed)
|
|
@@ -318,4 +301,4 @@ void xremote_canvas_draw_frame(Canvas* canvas, bool pressed, uint8_t x, uint8_t
|
|
|
|
|
|
|
|
canvas_draw_str(canvas, x + 3, y + 11, text);
|
|
canvas_draw_str(canvas, x + 3, y + 11, text);
|
|
|
canvas_set_color(canvas, ColorBlack);
|
|
canvas_set_color(canvas, ColorBlack);
|
|
|
-}
|
|
|
|
|
|
|
+}
|