mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-24 03:29:57 -07:00
still under construction
This commit is contained in:
@@ -143,33 +143,18 @@ const CanvasFontParameters* canvas_get_font_params(const Canvas* canvas, Font fo
|
||||
|
||||
void canvas_clear(Canvas* canvas) {
|
||||
furi_check(canvas);
|
||||
furi_delay_ms (500);
|
||||
NotificationApp* app = malloc (sizeof(NotificationApp));
|
||||
app = furi_record_open(RECORD_NOTIFICATION);
|
||||
|
||||
// open Notification record for access to NotificationApp settings
|
||||
// NotificationApp* app = malloc (sizeof(NotificationApp));
|
||||
// app = furi_record_open(RECORD_NOTIFICATION);
|
||||
|
||||
if(app->settings.lcd_inverse) {
|
||||
if(lcd_inverted) {
|
||||
u8g2_FillBuffer(&canvas->fb);
|
||||
} else {
|
||||
u8g2_ClearBuffer(&canvas->fb);
|
||||
}
|
||||
|
||||
u8g2_ClearBuffer(&canvas->fb);
|
||||
// furi_record_close (RECORD_NOTIFICATION);
|
||||
// free (app);
|
||||
}
|
||||
|
||||
void canvas_set_color(Canvas* canvas, Color color) {
|
||||
furi_check(canvas);
|
||||
furi_delay_ms (500);
|
||||
// open Notification record for access to NotificationApp settings
|
||||
NotificationApp* app = malloc (sizeof(NotificationApp));
|
||||
app = furi_record_open(RECORD_NOTIFICATION);
|
||||
|
||||
if(app->settings.lcd_inverse) {
|
||||
if(lcd_inverted) {
|
||||
if(color == ColorBlack) {
|
||||
color = ColorWhite;
|
||||
} else if(color == ColorWhite) {
|
||||
@@ -185,24 +170,14 @@ void canvas_set_font_direction(Canvas* canvas, CanvasDirection dir) {
|
||||
}
|
||||
|
||||
void canvas_invert_color(Canvas* canvas) {
|
||||
|
||||
// // open Notification record for access to NotificationApp settings
|
||||
// NotificationApp* app = malloc (sizeof(NotificationApp));
|
||||
// app = furi_record_open(RECORD_NOTIFICATION);
|
||||
|
||||
// if((canvas->fb.draw_color == ColorXOR) && app->settings.lcd_inverse) {
|
||||
// // ColorXOR = 0x02, inversion change it to White = 0x00
|
||||
// // but if we have lcd_inverse ON then we need Black =0x01 instead White 0x00
|
||||
// // so we force changing color to black
|
||||
// canvas->fb.draw_color = ColorBlack;
|
||||
// } else {
|
||||
// canvas->fb.draw_color = !canvas->fb.draw_color;
|
||||
// }
|
||||
|
||||
// furi_record_close (RECORD_NOTIFICATION);
|
||||
// free (app);
|
||||
|
||||
canvas->fb.draw_color = !canvas->fb.draw_color;
|
||||
if((canvas->fb.draw_color == ColorXOR) && lcd_inverted) {
|
||||
// ColorXOR = 0x02, inversion change it to White = 0x00
|
||||
// but if we have lcd_inverse ON then we need Black =0x01 instead White 0x00
|
||||
// so we force changing color to black
|
||||
canvas->fb.draw_color = ColorBlack;
|
||||
} else {
|
||||
canvas->fb.draw_color = !canvas->fb.draw_color;
|
||||
}
|
||||
}
|
||||
|
||||
void canvas_set_font(Canvas* canvas, Font font) {
|
||||
|
||||
@@ -620,6 +620,8 @@ static NotificationApp* notification_app_alloc(void) {
|
||||
furi_timer_alloc(night_shift_timer_callback, FuriTimerTypePeriodic, app);
|
||||
// --- NIGHT SHIFT END ---
|
||||
|
||||
lcd_inverted = false;
|
||||
|
||||
return app;
|
||||
}
|
||||
|
||||
@@ -650,6 +652,9 @@ static void notification_apply_settings(NotificationApp* app) {
|
||||
night_shift_timer_start(app);
|
||||
}
|
||||
// --- NIGHT SHIFT END ---
|
||||
|
||||
//setup global variable "inverted" by settings value;
|
||||
lcd_inverted = app->settings.lcd_inverse;
|
||||
}
|
||||
|
||||
static void notification_init_settings(NotificationApp* app) {
|
||||
|
||||
@@ -51,8 +51,6 @@ typedef struct {
|
||||
bool lcd_inverse;
|
||||
} NotificationSettings;
|
||||
|
||||
//extern NotificationSettings settings;
|
||||
|
||||
struct NotificationApp {
|
||||
FuriMessageQueue* queue;
|
||||
FuriPubSub* event_record;
|
||||
@@ -72,3 +70,6 @@ struct NotificationApp {
|
||||
void notification_message_save_settings(NotificationApp* app);
|
||||
void night_shift_timer_start(NotificationApp* app);
|
||||
void night_shift_timer_stop(NotificationApp* app);
|
||||
|
||||
//global variable for using in canvac.c
|
||||
extern bool lcd_inverted;
|
||||
|
||||
@@ -354,6 +354,10 @@ static void lcd_inverse_changed(VariableItem* item) {
|
||||
|
||||
variable_item_set_current_value_text(item, lcd_inverse_text[index]);
|
||||
app->notification->settings.lcd_inverse = lcd_inverse_value[index];
|
||||
|
||||
//setup global variable for using in canvas.c
|
||||
lcd_inverted = lcd_inverse_value[index];
|
||||
|
||||
notification_message(app->notification, &sequence_display_backlight_on);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user