Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
MX
2026-02-10 00:04:38 +03:00
19 changed files with 217 additions and 34 deletions

View File

@@ -101,12 +101,39 @@ void subghz_txrx_set_preset(
size_t preset_data_size) { size_t preset_data_size) {
furi_assert(instance); furi_assert(instance);
furi_string_set(instance->preset->name, preset_name); furi_string_set(instance->preset->name, preset_name);
SubGhzRadioPreset* preset = instance->preset; SubGhzRadioPreset* preset = instance->preset;
preset->frequency = frequency; preset->frequency = frequency;
preset->data = preset_data; preset->data = preset_data;
preset->data_size = preset_data_size; preset->data_size = preset_data_size;
} }
uint8_t*
subghz_txrx_set_tx_power(uint8_t* preset_data, size_t preset_data_size, uint32_t tx_power) {
#define TX_POWER_OFFSET 7
#define TX_PRESET_POWER_COUNT 11
const uint32_t tx_power_value[TX_PRESET_POWER_COUNT] = {
0,
0xC0,
0xC5,
0xCD,
0x86,
0x50,
0x37,
0x26,
0x1D,
0x17,
0x03,
};
//Set the TX Power Here in the CC1101 register...
if(tx_power)
preset_data[preset_data_size - TX_POWER_OFFSET] = (uint8_t)tx_power_value[tx_power];
//Pass back the preset_so we can call one liners.
return preset_data;
}
const char* subghz_txrx_get_preset_name(SubGhzTxRx* instance, const char* preset) { const char* subghz_txrx_get_preset_name(SubGhzTxRx* instance, const char* preset) {
UNUSED(instance); UNUSED(instance);
const char* preset_name = ""; const char* preset_name = "";
@@ -677,20 +704,27 @@ void subghz_txrx_set_default_preset(SubGhzTxRx* instance, uint32_t frequency) {
subghz_txrx_set_preset(instance, default_modulation, frequency, NULL, 0); subghz_txrx_set_preset(instance, default_modulation, frequency, NULL, 0);
} }
const char* const char* subghz_txrx_set_preset_internal(
subghz_txrx_set_preset_internal(SubGhzTxRx* instance, uint32_t frequency, uint8_t index) { SubGhzTxRx* instance,
uint32_t frequency,
uint8_t index,
uint32_t tx_power) {
furi_assert(instance); furi_assert(instance);
//Grab the prset name.
SubGhzSetting* setting = subghz_txrx_get_setting(instance); SubGhzSetting* setting = subghz_txrx_get_setting(instance);
const char* preset_name = subghz_setting_get_preset_name(setting, index); const char* preset_name = subghz_setting_get_preset_name(setting, index);
subghz_setting_set_default_frequency(setting, frequency); subghz_setting_set_default_frequency(setting, frequency);
subghz_txrx_set_preset( //Get the preset data now so we can set TX power.
instance, uint8_t* preset_data = subghz_setting_get_preset_data(setting, index);
preset_name, size_t preset_data_size = subghz_setting_get_preset_data_size(setting, index);
frequency,
subghz_setting_get_preset_data(setting, index), //Edit TX power, if necessary.
subghz_setting_get_preset_data_size(setting, index)); subghz_txrx_set_tx_power(preset_data, preset_data_size, tx_power);
//Set the Updated Preset.
subghz_txrx_set_preset(instance, preset_name, frequency, preset_data, preset_data_size);
return preset_name; return preset_name;
} }

View File

@@ -57,6 +57,16 @@ void subghz_txrx_set_preset(
uint8_t* preset_data, uint8_t* preset_data,
size_t preset_data_size); size_t preset_data_size);
/**
* Set TX Power
*
* @param preset_data Data of preset
* @param preset_data_size Size of preset data
* @param tx_power Menu Index of TX Power Setting. (Saves iterating in Config enter)
*/
uint8_t*
subghz_txrx_set_tx_power(uint8_t* preset_data, size_t preset_data_size, uint32_t tx_power);
/** /**
* Get name of preset * Get name of preset
* *
@@ -360,7 +370,11 @@ void subghz_txrx_set_default_preset(SubGhzTxRx* instance, uint32_t frequency);
* @param instance - instance Pointer to a SubGhzTxRx * @param instance - instance Pointer to a SubGhzTxRx
* @param frequency - frequency of new preset * @param frequency - frequency of new preset
* @param index - index of preset taken from SubGhzSetting * @param index - index of preset taken from SubGhzSetting
* @param tx_power - index of TX Power menu index option to use.
* @return const char* - name of preset * @return const char* - name of preset
*/ */
const char* const char* subghz_txrx_set_preset_internal(
subghz_txrx_set_preset_internal(SubGhzTxRx* instance, uint32_t frequency, uint8_t index); SubGhzTxRx* instance,
uint32_t frequency,
uint8_t index,
uint32_t tx_power);

View File

@@ -66,6 +66,22 @@ const int32_t debug_counter_val[DEBUG_COUNTER_COUNT] = {
-50, -50,
}; };
//TX Power
#define TX_POWER_COUNT 11
const char* const tx_power_text[TX_POWER_COUNT] = {
"Preset",
"12dBm",
"10dBm",
"7dBm",
"5dBm",
"0dBm",
"-6dBm",
"-10dBm",
"-15dBm",
"-20dBm",
"-30dBm",
};
static void subghz_scene_radio_settings_set_device(VariableItem* item) { static void subghz_scene_radio_settings_set_device(VariableItem* item) {
SubGhz* subghz = variable_item_get_context(item); SubGhz* subghz = variable_item_get_context(item);
uint8_t index = variable_item_get_current_value_index(item); uint8_t index = variable_item_get_current_value_index(item);
@@ -80,6 +96,20 @@ static void subghz_scene_radio_settings_set_device(VariableItem* item) {
subghz_txrx_radio_device_set(subghz->txrx, radio_device_value[index]); subghz_txrx_radio_device_set(subghz->txrx, radio_device_value[index]);
} }
static void subghz_scene_radio_settings_set_tx_power(VariableItem* item) {
SubGhz* subghz = variable_item_get_context(item);
uint8_t index = variable_item_get_current_value_index(item);
//Update the Menu Item on screen
variable_item_set_current_value_text(item, tx_power_text[index]);
//Set TX power and remember setting
subghz->last_settings->tx_power = subghz->tx_power = index;
//Save the settings now, this is the convention here!
subghz_last_settings_save(subghz->last_settings);
}
static void subghz_scene_receiver_config_set_debug_pin(VariableItem* item) { static void subghz_scene_receiver_config_set_debug_pin(VariableItem* item) {
SubGhz* subghz = variable_item_get_context(item); SubGhz* subghz = variable_item_get_context(item);
uint8_t index = variable_item_get_current_value_index(item); uint8_t index = variable_item_get_current_value_index(item);
@@ -144,6 +174,18 @@ void subghz_scene_radio_settings_on_enter(void* context) {
variable_item_set_current_value_index(item, value_index); variable_item_set_current_value_index(item, value_index);
variable_item_set_current_value_text(item, radio_device_text[value_index]); variable_item_set_current_value_text(item, radio_device_text[value_index]);
//Add TX Power
item = variable_item_list_add(
subghz->variable_item_list,
"TX Power",
TX_POWER_COUNT,
subghz_scene_radio_settings_set_tx_power,
subghz);
value_index = subghz->tx_power;
variable_item_set_current_value_index(item, value_index);
variable_item_set_current_value_text(item, tx_power_text[value_index]);
item = variable_item_list_add( item = variable_item_list_add(
variable_item_list, variable_item_list,
"Protocol Names", "Protocol Names",

View File

@@ -110,7 +110,8 @@ void subghz_scene_read_raw_on_enter(void* context) {
subghz_txrx_set_preset_internal( subghz_txrx_set_preset_internal(
subghz->txrx, subghz->txrx,
subghz->last_settings->frequency, subghz->last_settings->frequency,
subghz->last_settings->preset_index); subghz->last_settings->preset_index,
subghz->last_settings->tx_power);
} }
} }
subghz_scene_read_raw_update_statusbar(subghz); subghz_scene_read_raw_update_statusbar(subghz);

View File

@@ -165,11 +165,15 @@ void subghz_scene_receiver_on_enter(void* context) {
if(subghz_rx_key_state_get(subghz) == SubGhzRxKeyStateIDLE) { if(subghz_rx_key_state_get(subghz) == SubGhzRxKeyStateIDLE) {
subghz_txrx_set_preset_internal( subghz_txrx_set_preset_internal(
subghz->txrx, subghz->last_settings->frequency, subghz->last_settings->preset_index); subghz->txrx,
subghz->last_settings->frequency,
subghz->last_settings->preset_index,
subghz->last_settings->tx_power);
subghz->filter = subghz->last_settings->filter; subghz->filter = subghz->last_settings->filter;
subghz_txrx_receiver_set_filter(subghz->txrx, subghz->filter); subghz_txrx_receiver_set_filter(subghz->txrx, subghz->filter);
subghz->ignore_filter = subghz->last_settings->ignore_filter; subghz->ignore_filter = subghz->last_settings->ignore_filter;
subghz->tx_power = subghz->last_settings->tx_power;
subghz_history_reset(history); subghz_history_reset(history);
subghz_rx_key_state_set(subghz, SubGhzRxKeyStateStart); subghz_rx_key_state_set(subghz, SubGhzRxKeyStateStart);

View File

@@ -185,6 +185,11 @@ static void subghz_scene_receiver_config_set_frequency(VariableItem* item) {
frequency / 1000000, frequency / 1000000,
(frequency % 1000000) / 10000); (frequency % 1000000) / 10000);
variable_item_set_current_value_text(item, text_buf); variable_item_set_current_value_text(item, text_buf);
//Set TX Power
subghz_txrx_set_tx_power(preset.data, preset.data_size, subghz->tx_power);
//Set the preset now.
subghz_txrx_set_preset( subghz_txrx_set_preset(
subghz->txrx, subghz->txrx,
furi_string_get_cstr(preset.name), furi_string_get_cstr(preset.name),
@@ -211,12 +216,14 @@ static void subghz_scene_receiver_config_set_preset(VariableItem* item) {
variable_item_set_current_value_text(item, preset_name); variable_item_set_current_value_text(item, preset_name);
//subghz->last_settings->preset = index; //subghz->last_settings->preset = index;
SubGhzRadioPreset preset = subghz_txrx_get_preset(subghz->txrx); SubGhzRadioPreset preset = subghz_txrx_get_preset(subghz->txrx);
uint8_t* preset_data = subghz_setting_get_preset_data(setting, index);
size_t preset_data_size = subghz_setting_get_preset_data_size(setting, index);
//Edit TX power, if necessary.
subghz_txrx_set_tx_power(preset_data, preset_data_size, subghz->tx_power);
subghz_txrx_set_preset( subghz_txrx_set_preset(
subghz->txrx, subghz->txrx, preset_name, preset.frequency, preset_data, preset_data_size);
preset_name,
preset.frequency,
subghz_setting_get_preset_data(setting, index),
subghz_setting_get_preset_data_size(setting, index));
subghz->last_settings->preset_index = index; subghz->last_settings->preset_index = index;
} }
@@ -242,6 +249,9 @@ static void subghz_scene_receiver_config_set_hopping(VariableItem* item) {
(frequency % 1000000) / 10000); (frequency % 1000000) / 10000);
variable_item_set_current_value_text(frequency_item, text_buf); variable_item_set_current_value_text(frequency_item, text_buf);
//Edit TX power, if necessary.
subghz_txrx_set_tx_power(preset.data, preset.data_size, subghz->tx_power);
// Maybe better add one more function with only with the frequency argument? // Maybe better add one more function with only with the frequency argument?
subghz_txrx_set_preset( subghz_txrx_set_preset(
subghz->txrx, subghz->txrx,
@@ -341,7 +351,8 @@ static void subghz_scene_receiver_config_var_list_enter_callback(void* context,
subghz_txrx_set_preset_internal( subghz_txrx_set_preset_internal(
subghz->txrx, subghz->txrx,
SUBGHZ_LAST_SETTING_DEFAULT_FREQUENCY, SUBGHZ_LAST_SETTING_DEFAULT_FREQUENCY,
SUBGHZ_LAST_SETTING_DEFAULT_PRESET); SUBGHZ_LAST_SETTING_DEFAULT_PRESET,
subghz->tx_power);
SubGhzSetting* setting = subghz_txrx_get_setting(subghz->txrx); SubGhzSetting* setting = subghz_txrx_get_setting(subghz->txrx);
SubGhzRadioPreset preset = subghz_txrx_get_preset(subghz->txrx); SubGhzRadioPreset preset = subghz_txrx_get_preset(subghz->txrx);
@@ -359,7 +370,7 @@ static void subghz_scene_receiver_config_var_list_enter_callback(void* context,
subghz->last_settings->ignore_filter = subghz->ignore_filter; subghz->last_settings->ignore_filter = subghz->ignore_filter;
subghz->last_settings->filter = subghz->filter; subghz->last_settings->filter = subghz->filter;
subghz->last_settings->delete_old_signals = false; subghz->last_settings->delete_old_signals = false;
subghz->last_settings->tx_power = subghz->tx_power = 0;
subghz_txrx_speaker_set_state(subghz->txrx, speaker_value[default_index]); subghz_txrx_speaker_set_state(subghz->txrx, speaker_value[default_index]);
subghz_txrx_hopper_set_state(subghz->txrx, hopping_value[default_index]); subghz_txrx_hopper_set_state(subghz->txrx, hopping_value[default_index]);

View File

@@ -36,6 +36,10 @@ static bool subghz_scene_receiver_info_update_parser(void* context) {
SubGhzRadioPreset* preset = SubGhzRadioPreset* preset =
subghz_history_get_radio_preset(subghz->history, subghz->idx_menu_chosen); subghz_history_get_radio_preset(subghz->history, subghz->idx_menu_chosen);
//Edit TX power, if necessary.
subghz_txrx_set_tx_power(preset->data, preset->data_size, subghz->tx_power);
subghz_txrx_set_preset( subghz_txrx_set_preset(
subghz->txrx, subghz->txrx,
furi_string_get_cstr(preset->name), furi_string_get_cstr(preset->name),

View File

@@ -207,7 +207,10 @@ SubGhz* subghz_alloc(bool alloc_for_tx_only) {
if(!alloc_for_tx_only) { if(!alloc_for_tx_only) {
subghz_txrx_set_preset_internal( subghz_txrx_set_preset_internal(
subghz->txrx, subghz->last_settings->frequency, subghz->last_settings->preset_index); subghz->txrx,
subghz->last_settings->frequency,
subghz->last_settings->preset_index,
subghz->tx_power);
subghz->history = subghz_history_alloc(); subghz->history = subghz_history_alloc();
} }
@@ -218,10 +221,13 @@ SubGhz* subghz_alloc(bool alloc_for_tx_only) {
if(!alloc_for_tx_only) { if(!alloc_for_tx_only) {
subghz->ignore_filter = subghz->last_settings->ignore_filter; subghz->ignore_filter = subghz->last_settings->ignore_filter;
subghz->filter = subghz->last_settings->filter; subghz->filter = subghz->last_settings->filter;
subghz->tx_power = subghz->last_settings->tx_power;
} else { } else {
subghz->filter = SubGhzProtocolFlag_Decodable; subghz->filter = SubGhzProtocolFlag_Decodable;
subghz->ignore_filter = 0x0; subghz->ignore_filter = 0x0;
subghz->tx_power = 0;
} }
subghz_txrx_receiver_set_filter(subghz->txrx, subghz->filter); subghz_txrx_receiver_set_filter(subghz->txrx, subghz->filter);
subghz_txrx_set_need_save_callback(subghz->txrx, subghz_save_to_file, subghz); subghz_txrx_set_need_save_callback(subghz->txrx, subghz_save_to_file, subghz);

View File

@@ -137,12 +137,19 @@ bool subghz_key_load(SubGhz* subghz, const char* file_path, bool show_dialog) {
} }
size_t preset_index = size_t preset_index =
subghz_setting_get_inx_preset_by_name(setting, furi_string_get_cstr(temp_str)); subghz_setting_get_inx_preset_by_name(setting, furi_string_get_cstr(temp_str));
//Edit TX power, if necessary.
uint8_t* preset_data = subghz_setting_get_preset_data(setting, preset_index);
size_t preset_data_size = subghz_setting_get_preset_data_size(setting, preset_index);
subghz_txrx_set_tx_power(preset_data, preset_data_size, subghz->tx_power);
//Set the Updated Preset.
subghz_txrx_set_preset( subghz_txrx_set_preset(
subghz->txrx, subghz->txrx,
furi_string_get_cstr(temp_str), furi_string_get_cstr(temp_str),
temp_data32, temp_data32,
subghz_setting_get_preset_data(setting, preset_index), preset_data,
subghz_setting_get_preset_data_size(setting, preset_index)); preset_data_size);
//Load protocol //Load protocol
if(!flipper_format_read_string(fff_data_file, "Protocol", temp_str)) { if(!flipper_format_read_string(fff_data_file, "Protocol", temp_str)) {

View File

@@ -93,7 +93,7 @@ struct SubGhz {
uint16_t idx_menu_chosen; uint16_t idx_menu_chosen;
SubGhzLoadTypeFile load_type_file; SubGhzLoadTypeFile load_type_file;
uint32_t tx_power;
void* rpc_ctx; void* rpc_ctx;
}; };

View File

@@ -19,6 +19,7 @@
#define SUBGHZ_LAST_SETTING_FIELD_DELETE_OLD "DelOldSignals" #define SUBGHZ_LAST_SETTING_FIELD_DELETE_OLD "DelOldSignals"
#define SUBGHZ_LAST_SETTING_FIELD_HOPPING_THRESHOLD "HoppingThreshold" #define SUBGHZ_LAST_SETTING_FIELD_HOPPING_THRESHOLD "HoppingThreshold"
#define SUBGHZ_LAST_SETTING_FIELD_LED_AND_POWER_AMP "LedAndPowerAmp" #define SUBGHZ_LAST_SETTING_FIELD_LED_AND_POWER_AMP "LedAndPowerAmp"
#define SUBGHZ_LAST_SETTING_FIELD_TX_POWER "TXPower"
SubGhzLastSettings* subghz_last_settings_alloc(void) { SubGhzLastSettings* subghz_last_settings_alloc(void) {
SubGhzLastSettings* instance = malloc(sizeof(SubGhzLastSettings)); SubGhzLastSettings* instance = malloc(sizeof(SubGhzLastSettings));
@@ -119,6 +120,10 @@ void subghz_last_settings_load(SubGhzLastSettings* instance, size_t preset_count
1)) { 1)) {
flipper_format_rewind(fff_data_file); flipper_format_rewind(fff_data_file);
} }
if(!flipper_format_read_uint32(
fff_data_file, SUBGHZ_LAST_SETTING_FIELD_TX_POWER, &instance->tx_power, 1)) {
flipper_format_rewind(fff_data_file);
}
if(!flipper_format_read_float( if(!flipper_format_read_float(
fff_data_file, fff_data_file,
SUBGHZ_LAST_SETTING_FIELD_HOPPING_THRESHOLD, SUBGHZ_LAST_SETTING_FIELD_HOPPING_THRESHOLD,
@@ -222,6 +227,10 @@ bool subghz_last_settings_save(SubGhzLastSettings* instance) {
file, SUBGHZ_LAST_SETTING_FIELD_DELETE_OLD, &instance->delete_old_signals, 1)) { file, SUBGHZ_LAST_SETTING_FIELD_DELETE_OLD, &instance->delete_old_signals, 1)) {
break; break;
} }
if(!flipper_format_write_uint32(
file, SUBGHZ_LAST_SETTING_FIELD_TX_POWER, &instance->tx_power, 1)) {
break;
}
if(!flipper_format_write_float( if(!flipper_format_write_float(
file, file,
SUBGHZ_LAST_SETTING_FIELD_HOPPING_THRESHOLD, SUBGHZ_LAST_SETTING_FIELD_HOPPING_THRESHOLD,

View File

@@ -26,6 +26,7 @@ typedef struct {
bool delete_old_signals; bool delete_old_signals;
float hopping_threshold; float hopping_threshold;
bool leds_and_amp; bool leds_and_amp;
uint32_t tx_power;
} SubGhzLastSettings; } SubGhzLastSettings;
SubGhzLastSettings* subghz_last_settings_alloc(void); SubGhzLastSettings* subghz_last_settings_alloc(void);

View File

@@ -65,6 +65,7 @@ typedef enum {
NotificationMessageTypeDelay, NotificationMessageTypeDelay,
NotificationMessageTypeLedDisplayBacklight, NotificationMessageTypeLedDisplayBacklight,
NotificationMessageTypeLedDisplayBacklightForceOn,
NotificationMessageTypeLedDisplayBacklightEnforceOn, NotificationMessageTypeLedDisplayBacklightEnforceOn,
NotificationMessageTypeLedDisplayBacklightEnforceAuto, NotificationMessageTypeLedDisplayBacklightEnforceAuto,

View File

@@ -248,7 +248,7 @@ void night_shift_timer_start(NotificationApp* app) {
if(furi_timer_is_running(app->night_shift_timer)) { if(furi_timer_is_running(app->night_shift_timer)) {
furi_timer_stop(app->night_shift_timer); furi_timer_stop(app->night_shift_timer);
} }
furi_timer_start(app->night_shift_timer, furi_ms_to_ticks(2000)); furi_timer_start(app->night_shift_timer, furi_ms_to_ticks(1000));
} }
} }
@@ -277,6 +277,12 @@ void night_shift_timer_callback(void* context) {
} }
} }
// force backlight ON when night_shift_demo_timer will be ended
void night_shift_demo_timer_callback(void* context) {
furi_assert(context);
NotificationApp* app = context;
notification_message(app, &sequence_display_backlight_force_on);
}
// --- NIGHT SHIFT END --- // --- NIGHT SHIFT END ---
void notification_message_save_settings(NotificationApp* app) { void notification_message_save_settings(NotificationApp* app) {
@@ -498,6 +504,19 @@ static void notification_process_notification_message(
} }
} }
break; break;
case NotificationMessageTypeLedDisplayBacklightForceOn:
// Force Backlight ON even if its ON now
lcd_backlight_is_on = false;
notification_apply_notification_led_layer(
&app->display,
notification_message->data.led.value * display_brightness_setting *
app->current_night_shift * 1.0f);
reset_mask |= reset_display_mask;
lcd_backlight_is_on = true;
//start rgb_mod_rainbow_timer when display backlight is ON and all corresponding settings is ON too
rainbow_timer_starter(app);
break;
case NotificationMessageTypeLedDisplayBacklightEnforceOn: case NotificationMessageTypeLedDisplayBacklightEnforceOn:
if(!app->display_led_lock) { if(!app->display_led_lock) {
app->display_led_lock = true; app->display_led_lock = true;
@@ -740,6 +759,9 @@ static bool notification_load_settings(NotificationApp* app) {
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;
} }
@@ -925,6 +947,11 @@ int32_t notification_srv(void* p) {
// define rainbow_timer and they callback // define rainbow_timer and they callback
app->rainbow_timer = furi_timer_alloc(rainbow_timer_callback, FuriTimerTypePeriodic, app); app->rainbow_timer = furi_timer_alloc(rainbow_timer_callback, FuriTimerTypePeriodic, app);
// define night_shift_demo_timer and they callback.
// used for Setting menu to demonstrate night_shift_backlight when user change value
app->night_shift_demo_timer =
furi_timer_alloc(night_shift_demo_timer_callback, FuriTimerTypeOnce, app);
// if rgb_backlight_installed then start rainbow or set leds colors from saved settings (default index = 0) // if rgb_backlight_installed then start rainbow or set leds colors from saved settings (default index = 0)
if(app->settings.rgb.rgb_backlight_installed) { if(app->settings.rgb.rgb_backlight_installed) {
if(app->settings.rgb.rainbow_mode > 0) { if(app->settings.rgb.rainbow_mode > 0) {

View File

@@ -86,6 +86,7 @@ struct NotificationApp {
NotificationSettings settings; NotificationSettings settings;
FuriTimer* night_shift_timer; FuriTimer* night_shift_timer;
FuriTimer* night_shift_demo_timer;
float current_night_shift; float current_night_shift;
FuriTimer* rainbow_timer; FuriTimer* rainbow_timer;

View File

@@ -17,6 +17,12 @@ const NotificationMessage message_display_backlight_off = {
.data.led.value = 0x00, .data.led.value = 0x00,
}; };
/** Display: backlight wakeup even if its ON now */
const NotificationMessage message_display_backlight_force_on = {
.type = NotificationMessageTypeLedDisplayBacklightForceOn,
.data.led.value = 0xFF,
};
/** Display: backlight always on */ /** Display: backlight always on */
const NotificationMessage message_display_backlight_enforce_on = { const NotificationMessage message_display_backlight_enforce_on = {
.type = NotificationMessageTypeLedDisplayBacklightEnforceOn, .type = NotificationMessageTypeLedDisplayBacklightEnforceOn,
@@ -259,6 +265,12 @@ const NotificationSequence sequence_display_backlight_off = {
NULL, NULL,
}; };
/** Display: backlight wakeup even if its ON now */
const NotificationSequence sequence_display_backlight_force_on = {
&message_display_backlight_force_on,
NULL,
};
/** Display: backlight always on lock */ /** Display: backlight always on lock */
const NotificationSequence sequence_display_backlight_enforce_on = { const NotificationSequence sequence_display_backlight_enforce_on = {
&message_display_backlight_enforce_on, &message_display_backlight_enforce_on,

View File

@@ -87,7 +87,8 @@ extern const NotificationSequence sequence_display_backlight_on;
extern const NotificationSequence sequence_display_backlight_off; extern const NotificationSequence sequence_display_backlight_off;
/** Display: backlight force off after a delay of 1000ms */ /** Display: backlight force off after a delay of 1000ms */
extern const NotificationSequence sequence_display_backlight_off_delay_1000; extern const NotificationSequence sequence_display_backlight_off_delay_1000;
/** Display: backlight wakeup even if its ON now */
extern const NotificationSequence sequence_display_backlight_force_on;
/** Display: backlight always on lock */ /** Display: backlight always on lock */
extern const NotificationSequence sequence_display_backlight_enforce_on; extern const NotificationSequence sequence_display_backlight_enforce_on;
/** Display: backlight always on unlock */ /** Display: backlight always on unlock */

View File

@@ -87,7 +87,7 @@ const float volume_value[VOLUME_COUNT] = {
#define DELAY_COUNT 12 #define DELAY_COUNT 12
const char* const delay_text[DELAY_COUNT] = { const char* const delay_text[DELAY_COUNT] = {
"Always ON", "Always ON",
"1s", "2s",
"5s", "5s",
"10s", "10s",
"15s", "15s",
@@ -100,7 +100,7 @@ const char* const delay_text[DELAY_COUNT] = {
"30min", "30min",
}; };
const uint32_t delay_value[DELAY_COUNT] = const uint32_t delay_value[DELAY_COUNT] =
{0, 1000, 5000, 10000, 15000, 30000, 60000, 90000, 120000, 300000, 600000, 1800000}; {0, 2000, 5000, 10000, 15000, 30000, 60000, 90000, 120000, 300000, 600000, 1800000};
#define VIBRO_COUNT 2 #define VIBRO_COUNT 2
const char* const vibro_text[VIBRO_COUNT] = { const char* const vibro_text[VIBRO_COUNT] = {
@@ -295,7 +295,7 @@ static void backlight_changed(VariableItem* item) {
variable_item_set_current_value_text(item, backlight_text[index]); variable_item_set_current_value_text(item, backlight_text[index]);
app->notification->settings.display_brightness = backlight_value[index]; app->notification->settings.display_brightness = backlight_value[index];
notification_message(app->notification, &sequence_display_backlight_on); notification_message(app->notification, &sequence_display_backlight_force_on);
} }
static void screen_changed(VariableItem* item) { static void screen_changed(VariableItem* item) {
@@ -557,11 +557,6 @@ static void night_shift_changed(VariableItem* item) {
variable_item_set_current_value_text(item, night_shift_text[index]); variable_item_set_current_value_text(item, night_shift_text[index]);
app->notification->settings.night_shift = night_shift_value[index]; app->notification->settings.night_shift = night_shift_value[index];
app->notification->current_night_shift = night_shift_value[index];
app->notification->current_night_shift = night_shift_value[index];
// force demo night_shift brightness to rgb backlight and stock backlight
notification_message(app->notification, &sequence_display_backlight_on);
for(int i = 4; i < 6; i++) { for(int i = 4; i < 6; i++) {
VariableItem* t_item = variable_item_list_get(app->variable_item_list, i); VariableItem* t_item = variable_item_list_get(app->variable_item_list, i);
@@ -572,10 +567,22 @@ static void night_shift_changed(VariableItem* item) {
} }
} }
// force demo night_shift brightness to rgb backlight and stock backlight for 1,2 sec
// while 1,2 seconds are running, there is another timer "night_shift_timer" can change current_night_shift to day or night value
// so when night_shift_demo_timer ended backlight force ON to day or night brightness
app->notification->current_night_shift = night_shift_value[index];
notification_message(app->notification, &sequence_display_backlight_force_on);
if(night_shift_value[index] != 1) { if(night_shift_value[index] != 1) {
night_shift_timer_start(app->notification); night_shift_timer_start(app->notification);
if(furi_timer_is_running(app->notification->night_shift_demo_timer)) {
furi_timer_stop(app->notification->night_shift_demo_timer);
}
furi_timer_start(app->notification->night_shift_demo_timer, furi_ms_to_ticks(1200));
} else { } else {
night_shift_timer_stop(app->notification); night_shift_timer_stop(app->notification);
if(furi_timer_is_running(app->notification->night_shift_demo_timer))
furi_timer_stop(app->notification->night_shift_demo_timer);
} }
notification_message_save_settings(app->notification); notification_message_save_settings(app->notification);

View File

@@ -1,5 +1,5 @@
entry,status,name,type,params entry,status,name,type,params
Version,+,87.5,, Version,+,87.6,,
Header,+,applications/drivers/subghz/cc1101_ext/cc1101_ext_interconnect.h,, Header,+,applications/drivers/subghz/cc1101_ext/cc1101_ext_interconnect.h,,
Header,+,applications/services/applications.h,, Header,+,applications/services/applications.h,,
Header,+,applications/services/bt/bt_service/bt.h,, Header,+,applications/services/bt/bt_service/bt.h,,
@@ -5383,6 +5383,7 @@ Variable,+,sequence_charged,const NotificationSequence,
Variable,+,sequence_charging,const NotificationSequence, Variable,+,sequence_charging,const NotificationSequence,
Variable,+,sequence_display_backlight_enforce_auto,const NotificationSequence, Variable,+,sequence_display_backlight_enforce_auto,const NotificationSequence,
Variable,+,sequence_display_backlight_enforce_on,const NotificationSequence, Variable,+,sequence_display_backlight_enforce_on,const NotificationSequence,
Variable,+,sequence_display_backlight_force_on,const NotificationSequence,
Variable,+,sequence_display_backlight_off,const NotificationSequence, Variable,+,sequence_display_backlight_off,const NotificationSequence,
Variable,+,sequence_display_backlight_off_delay_1000,const NotificationSequence, Variable,+,sequence_display_backlight_off_delay_1000,const NotificationSequence,
Variable,+,sequence_display_backlight_on,const NotificationSequence, Variable,+,sequence_display_backlight_on,const NotificationSequence,
1 entry status name type params
2 Version + 87.5 87.6
3 Header + applications/drivers/subghz/cc1101_ext/cc1101_ext_interconnect.h
4 Header + applications/services/applications.h
5 Header + applications/services/bt/bt_service/bt.h
5383 Variable + sequence_charging const NotificationSequence
5384 Variable + sequence_display_backlight_enforce_auto const NotificationSequence
5385 Variable + sequence_display_backlight_enforce_on const NotificationSequence
5386 Variable + sequence_display_backlight_force_on const NotificationSequence
5387 Variable + sequence_display_backlight_off const NotificationSequence
5388 Variable + sequence_display_backlight_off_delay_1000 const NotificationSequence
5389 Variable + sequence_display_backlight_on const NotificationSequence