mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-12 20:08:36 -07:00
updated to match merge
This commit is contained in:
21
applications/external/barcode_gen/barcode_app.c
vendored
21
applications/external/barcode_gen/barcode_app.c
vendored
@@ -2,6 +2,9 @@
|
||||
|
||||
#include "barcode_app_icons.h"
|
||||
#include <assets_icons.h>
|
||||
#include <notification/notification.h>
|
||||
#include <notification/notification_messages.h>
|
||||
#include <notification/notification_app.h>
|
||||
|
||||
/**
|
||||
* Opens a file browser dialog and returns the filepath of the selected file
|
||||
@@ -11,6 +14,9 @@
|
||||
* file_path will be the folder path is nothing is selected
|
||||
* @returns true if a file is selected
|
||||
*/
|
||||
|
||||
NotificationApp* notifications = 0;
|
||||
|
||||
static bool select_file(const char* folder, FuriString* file_path) {
|
||||
DialogsApp* dialogs = furi_record_open(RECORD_DIALOGS);
|
||||
DialogsFileBrowserOptions browser_options;
|
||||
@@ -287,6 +293,12 @@ void free_app(BarcodeApp* app) {
|
||||
free(app);
|
||||
}
|
||||
|
||||
void set_backlight_brightness(float brightness) {
|
||||
NotificationApp* notifications = furi_record_open(RECORD_NOTIFICATION);
|
||||
notifications->settings.display_brightness = brightness;
|
||||
notification_message(notifications, &sequence_display_backlight_on);
|
||||
}
|
||||
|
||||
int32_t barcode_main(void* p) {
|
||||
UNUSED(p);
|
||||
BarcodeApp* app = malloc(sizeof(BarcodeApp));
|
||||
@@ -307,6 +319,13 @@ int32_t barcode_main(void* p) {
|
||||
|
||||
submenu_add_item(app->main_menu, "Edit Barcode", EditBarcodeItem, submenu_callback, app);
|
||||
|
||||
NotificationApp* notifications = furi_record_open(RECORD_NOTIFICATION);
|
||||
// Save original brightness
|
||||
float originalBrightness = notifications->settings.display_brightness;
|
||||
// force backlight and increase brightness
|
||||
notification_message_block(notifications, &sequence_display_backlight_enforce_on);
|
||||
set_backlight_brightness(10); // set to highest
|
||||
|
||||
/*****************************
|
||||
* Creating Text Input View
|
||||
******************************/
|
||||
@@ -344,6 +363,8 @@ int32_t barcode_main(void* p) {
|
||||
view_dispatcher_run(app->view_dispatcher);
|
||||
|
||||
free_app(app);
|
||||
notification_message_block(notifications, &sequence_display_backlight_enforce_auto);
|
||||
set_backlight_brightness(originalBrightness);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user