fix: Fix nice_view display widgets

This commit is contained in:
Joel Spadin
2023-08-27 18:33:29 -05:00
committed by Pete Johanson
parent b17d896c5c
commit 6a3cc914fc
4 changed files with 46 additions and 49 deletions

View File

@@ -31,7 +31,7 @@ struct peripheral_status_state {
bool connected;
};
static void draw_top(lv_obj_t *widget, lv_color_t cbuf[], struct status_state state) {
static void draw_top(lv_obj_t *widget, lv_color_t cbuf[], const struct status_state *state) {
lv_obj_t *canvas = lv_obj_get_child(widget, 0);
lv_draw_label_dsc_t label_dsc;
@@ -47,7 +47,7 @@ static void draw_top(lv_obj_t *widget, lv_color_t cbuf[], struct status_state st
// Draw output status
lv_canvas_draw_text(canvas, 0, 0, CANVAS_SIZE, &label_dsc,
state.connected ? LV_SYMBOL_WIFI : LV_SYMBOL_CLOSE);
state->connected ? LV_SYMBOL_WIFI : LV_SYMBOL_CLOSE);
// Rotate canvas
rotate_canvas(canvas, cbuf);
@@ -61,7 +61,7 @@ static void set_battery_status(struct zmk_widget_status *widget,
widget->state.battery = state.level;
draw_top(widget->obj, widget->cbuf, widget->state);
draw_top(widget->obj, widget->cbuf, &widget->state);
}
static void battery_status_update_cb(struct battery_status_state state) {
@@ -94,7 +94,7 @@ static void set_connection_status(struct zmk_widget_status *widget,
struct peripheral_status_state state) {
widget->state.connected = state.connected;
draw_top(widget->obj, widget->cbuf, widget->state);
draw_top(widget->obj, widget->cbuf, &widget->state);
}
static void output_status_update_cb(struct peripheral_status_state state) {