mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-22 05:14:46 -07:00
"kostylling" )))
This commit is contained in:
@@ -295,8 +295,8 @@ void night_shift_demo_timer_callback(void* context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// internal layer
|
// internal layer
|
||||||
static void notification_apply_internal_led_layer(
|
static void
|
||||||
NotificationLedLayer * layer, uint8_t layer_value) {
|
notification_apply_internal_led_layer(NotificationLedLayer* layer, uint8_t layer_value) {
|
||||||
furi_assert(layer);
|
furi_assert(layer);
|
||||||
furi_assert(layer->index < LayerMAX);
|
furi_assert(layer->index < LayerMAX);
|
||||||
|
|
||||||
@@ -331,7 +331,8 @@ void night_shift_demo_timer_callback(void* context) {
|
|||||||
|
|
||||||
// notification layer
|
// notification layer
|
||||||
static void notification_apply_notification_led_layer(
|
static void notification_apply_notification_led_layer(
|
||||||
NotificationLedLayer * layer, const uint8_t layer_value) {
|
NotificationLedLayer* layer,
|
||||||
|
const uint8_t layer_value) {
|
||||||
furi_assert(layer);
|
furi_assert(layer);
|
||||||
furi_assert(layer->index < LayerMAX);
|
furi_assert(layer->index < LayerMAX);
|
||||||
|
|
||||||
@@ -362,7 +363,9 @@ void night_shift_demo_timer_callback(void* context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void notification_reset_notification_layer(
|
static void notification_reset_notification_layer(
|
||||||
NotificationApp * app, uint8_t reset_mask, float display_brightness_set) {
|
NotificationApp* app,
|
||||||
|
uint8_t reset_mask,
|
||||||
|
float display_brightness_set) {
|
||||||
if(reset_mask & reset_blink_mask) {
|
if(reset_mask & reset_blink_mask) {
|
||||||
furi_hal_light_blink_stop();
|
furi_hal_light_blink_stop();
|
||||||
}
|
}
|
||||||
@@ -394,8 +397,7 @@ void night_shift_demo_timer_callback(void* context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void notification_apply_notification_leds(
|
static void notification_apply_notification_leds(NotificationApp* app, const uint8_t* values) {
|
||||||
NotificationApp * app, const uint8_t* values) {
|
|
||||||
for(uint8_t i = 0; i < NOTIFICATION_LED_COUNT; i++) {
|
for(uint8_t i = 0; i < NOTIFICATION_LED_COUNT; i++) {
|
||||||
notification_apply_notification_led_layer(
|
notification_apply_notification_led_layer(
|
||||||
&app->led[i], notification_settings_get_rgb_led_brightness(app, values[i]));
|
&app->led[i], notification_settings_get_rgb_led_brightness(app, values[i]));
|
||||||
@@ -407,8 +409,7 @@ void night_shift_demo_timer_callback(void* context) {
|
|||||||
return value * app->settings.display_brightness;
|
return value * app->settings.display_brightness;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t notification_settings_get_rgb_led_brightness(
|
static uint8_t notification_settings_get_rgb_led_brightness(NotificationApp* app, uint8_t value) {
|
||||||
NotificationApp * app, uint8_t value) {
|
|
||||||
return value * app->settings.led_brightness;
|
return value * app->settings.led_brightness;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -452,7 +453,8 @@ void night_shift_demo_timer_callback(void* context) {
|
|||||||
|
|
||||||
// message processing
|
// message processing
|
||||||
static void notification_process_notification_message(
|
static void notification_process_notification_message(
|
||||||
NotificationApp * app, NotificationAppMessage * message) {
|
NotificationApp* app,
|
||||||
|
NotificationAppMessage* message) {
|
||||||
uint32_t notification_message_index = 0;
|
uint32_t notification_message_index = 0;
|
||||||
bool force_volume = false;
|
bool force_volume = false;
|
||||||
bool force_vibro = false;
|
bool force_vibro = false;
|
||||||
@@ -673,8 +675,8 @@ void night_shift_demo_timer_callback(void* context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void notification_process_internal_message(
|
static void
|
||||||
NotificationApp * app, NotificationAppMessage * message) {
|
notification_process_internal_message(NotificationApp* app, NotificationAppMessage* message) {
|
||||||
uint32_t notification_message_index = 0;
|
uint32_t notification_message_index = 0;
|
||||||
const NotificationMessage* notification_message;
|
const NotificationMessage* notification_message;
|
||||||
notification_message = (*message->sequence)[notification_message_index];
|
notification_message = (*message->sequence)[notification_message_index];
|
||||||
@@ -743,10 +745,7 @@ void night_shift_demo_timer_callback(void* context) {
|
|||||||
if(fs_result) {
|
if(fs_result) {
|
||||||
if(settings.version != NOTIFICATION_SETTINGS_VERSION) {
|
if(settings.version != NOTIFICATION_SETTINGS_VERSION) {
|
||||||
FURI_LOG_E(
|
FURI_LOG_E(
|
||||||
TAG,
|
TAG, "version(%d != %d) mismatch", settings.version, NOTIFICATION_SETTINGS_VERSION);
|
||||||
"version(%d != %d) mismatch",
|
|
||||||
settings.version,
|
|
||||||
NOTIFICATION_SETTINGS_VERSION);
|
|
||||||
} else {
|
} else {
|
||||||
furi_kernel_lock();
|
furi_kernel_lock();
|
||||||
memcpy(&app->settings, &settings, settings_size);
|
memcpy(&app->settings, &settings, settings_size);
|
||||||
@@ -760,6 +759,9 @@ void night_shift_demo_timer_callback(void* context) {
|
|||||||
storage_file_free(file);
|
storage_file_free(file);
|
||||||
furi_record_close(RECORD_STORAGE);
|
furi_record_close(RECORD_STORAGE);
|
||||||
|
|
||||||
|
// "kostyl" for update old setting to new without change settings version
|
||||||
|
if(app->settings.display_off_delay_ms < 2000) app->settings.display_off_delay_ms = 2000;
|
||||||
|
|
||||||
return fs_result;
|
return fs_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -972,8 +974,7 @@ void night_shift_demo_timer_callback(void* context) {
|
|||||||
|
|
||||||
NotificationAppMessage message;
|
NotificationAppMessage message;
|
||||||
while(1) {
|
while(1) {
|
||||||
furi_check(
|
furi_check(furi_message_queue_get(app->queue, &message, FuriWaitForever) == FuriStatusOk);
|
||||||
furi_message_queue_get(app->queue, &message, FuriWaitForever) == FuriStatusOk);
|
|
||||||
|
|
||||||
switch(message.type) {
|
switch(message.type) {
|
||||||
case NotificationLayerMessage:
|
case NotificationLayerMessage:
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ typedef struct {
|
|||||||
Light light;
|
Light light;
|
||||||
} NotificationLedLayer;
|
} NotificationLedLayer;
|
||||||
|
|
||||||
#define NOTIFICATION_SETTINGS_VERSION 0x06
|
#define NOTIFICATION_SETTINGS_VERSION 0x05
|
||||||
#define NOTIFICATION_SETTINGS_PATH INT_PATH(NOTIFICATION_SETTINGS_FILE_NAME)
|
#define NOTIFICATION_SETTINGS_PATH INT_PATH(NOTIFICATION_SETTINGS_FILE_NAME)
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|||||||
Reference in New Issue
Block a user