mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-07-25 01:38:11 -07:00
Merge branch 'dev' of https://github.com/ClaraCrazy/Flipper-Xtreme into fix-bad_kb_bt-flipper_app-conflict
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
#include <string.h>
|
||||
#include <dolphin/dolphin.h>
|
||||
|
||||
#define INFRARED_TX_MIN_INTERVAL_MS 50U
|
||||
|
||||
static const NotificationSequence* infrared_notification_sequences[] = {
|
||||
&sequence_success,
|
||||
&sequence_set_only_green_255,
|
||||
@@ -308,10 +310,13 @@ bool infrared_rename_current_remote(Infrared* infrared, const char* name) {
|
||||
|
||||
void infrared_tx_start_signal(Infrared* infrared, InfraredSignal* signal) {
|
||||
if(infrared->app_state.is_transmitting) {
|
||||
FURI_LOG_D(INFRARED_LOG_TAG, "Transmitter is already active");
|
||||
return;
|
||||
} else {
|
||||
infrared->app_state.is_transmitting = true;
|
||||
}
|
||||
|
||||
const uint32_t time_elapsed = furi_get_tick() - infrared->app_state.last_transmit_time;
|
||||
|
||||
if(time_elapsed < INFRARED_TX_MIN_INTERVAL_MS) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(infrared_signal_is_raw(signal)) {
|
||||
@@ -328,6 +333,8 @@ void infrared_tx_start_signal(Infrared* infrared, InfraredSignal* signal) {
|
||||
infrared_worker_tx_set_get_signal_callback(
|
||||
infrared->worker, infrared_worker_tx_get_signal_steady_callback, infrared);
|
||||
infrared_worker_tx_start(infrared->worker);
|
||||
|
||||
infrared->app_state.is_transmitting = true;
|
||||
}
|
||||
|
||||
void infrared_tx_start_button_index(Infrared* infrared, size_t button_index) {
|
||||
@@ -337,26 +344,24 @@ void infrared_tx_start_button_index(Infrared* infrared, size_t button_index) {
|
||||
InfraredSignal* signal = infrared_remote_button_get_signal(button);
|
||||
|
||||
infrared_tx_start_signal(infrared, signal);
|
||||
infrared_play_notification_message(infrared, InfraredNotificationMessageBlinkStartSend);
|
||||
}
|
||||
|
||||
void infrared_tx_start_received(Infrared* infrared) {
|
||||
infrared_tx_start_signal(infrared, infrared->received_signal);
|
||||
infrared_play_notification_message(infrared, InfraredNotificationMessageBlinkStartSend);
|
||||
}
|
||||
|
||||
void infrared_tx_stop(Infrared* infrared) {
|
||||
if(!infrared->app_state.is_transmitting) {
|
||||
FURI_LOG_D(INFRARED_LOG_TAG, "Transmitter is already stopped");
|
||||
return;
|
||||
} else {
|
||||
infrared->app_state.is_transmitting = false;
|
||||
}
|
||||
|
||||
infrared_worker_tx_stop(infrared->worker);
|
||||
infrared_worker_tx_set_get_signal_callback(infrared->worker, NULL, NULL);
|
||||
|
||||
infrared_play_notification_message(infrared, InfraredNotificationMessageBlinkStop);
|
||||
|
||||
infrared->app_state.is_transmitting = false;
|
||||
infrared->app_state.last_transmit_time = furi_get_tick();
|
||||
}
|
||||
|
||||
void infrared_text_store_set(Infrared* infrared, uint32_t bank, const char* text, ...) {
|
||||
|
||||
@@ -70,6 +70,7 @@ typedef struct {
|
||||
InfraredEditTarget edit_target : 8;
|
||||
InfraredEditMode edit_mode : 8;
|
||||
int32_t current_button_index;
|
||||
uint32_t last_transmit_time;
|
||||
} InfraredAppState;
|
||||
|
||||
struct Infrared {
|
||||
|
||||
@@ -46,6 +46,9 @@ bool nfc_scene_read_card_success_on_event(void* context, SceneManagerEvent event
|
||||
if(event.event == GuiButtonTypeLeft) {
|
||||
consumed = scene_manager_previous_scene(nfc->scene_manager);
|
||||
}
|
||||
} else if(event.type == SceneManagerEventTypeBack) {
|
||||
consumed =
|
||||
scene_manager_search_and_switch_to_previous_scene(nfc->scene_manager, NfcSceneStart);
|
||||
}
|
||||
return consumed;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
enum VarItemListIndex {
|
||||
VarItemListIndexSortDirsFirst,
|
||||
VarItemListIndexDarkMode,
|
||||
VarItemListIndexLeftHanded,
|
||||
VarItemListIndexChangeDeviceName,
|
||||
};
|
||||
|
||||
@@ -27,6 +28,14 @@ static void xtreme_app_scene_misc_dark_mode_changed(VariableItem* item) {
|
||||
app->save_settings = true;
|
||||
}
|
||||
|
||||
static void xtreme_app_scene_misc_left_handed_changed(VariableItem* item) {
|
||||
XtremeApp* app = variable_item_get_context(item);
|
||||
bool value = variable_item_get_current_value_index(item);
|
||||
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
|
||||
XTREME_SETTINGS()->left_handed = value;
|
||||
app->save_settings = true;
|
||||
}
|
||||
|
||||
void xtreme_app_scene_misc_on_enter(void* context) {
|
||||
XtremeApp* app = context;
|
||||
XtremeSettings* xtreme_settings = XTREME_SETTINGS();
|
||||
@@ -43,6 +52,11 @@ void xtreme_app_scene_misc_on_enter(void* context) {
|
||||
variable_item_set_current_value_index(item, xtreme_settings->dark_mode);
|
||||
variable_item_set_current_value_text(item, xtreme_settings->dark_mode ? "ON" : "OFF");
|
||||
|
||||
item = variable_item_list_add(
|
||||
var_item_list, "Exp. Left Handed", 2, xtreme_app_scene_misc_left_handed_changed, app);
|
||||
variable_item_set_current_value_index(item, xtreme_settings->left_handed);
|
||||
variable_item_set_current_value_text(item, xtreme_settings->left_handed ? "ON" : "OFF");
|
||||
|
||||
variable_item_list_add(var_item_list, "Change Device Name", 0, NULL, app);
|
||||
|
||||
variable_item_list_set_enter_callback(
|
||||
|
||||
@@ -27,6 +27,8 @@ Canvas* canvas_init() {
|
||||
// Wake up display
|
||||
u8g2_SetPowerSave(&canvas->fb, 0);
|
||||
|
||||
canvas_set_orientation(canvas, CanvasOrientationHorizontal);
|
||||
|
||||
// Clear buffer and send to device
|
||||
canvas_clear(canvas);
|
||||
canvas_commit(canvas);
|
||||
@@ -408,6 +410,13 @@ void canvas_set_bitmap_mode(Canvas* canvas, bool alpha) {
|
||||
|
||||
void canvas_set_orientation(Canvas* canvas, CanvasOrientation orientation) {
|
||||
furi_assert(canvas);
|
||||
if(XTREME_SETTINGS()->left_handed) {
|
||||
if(orientation == CanvasOrientationHorizontal) {
|
||||
orientation = CanvasOrientationHorizontalFlip;
|
||||
} else if(orientation == CanvasOrientationHorizontalFlip) {
|
||||
orientation = CanvasOrientationHorizontal;
|
||||
}
|
||||
}
|
||||
if(canvas->orientation != orientation) {
|
||||
switch(orientation) {
|
||||
case CanvasOrientationHorizontal:
|
||||
|
||||
@@ -326,6 +326,25 @@ static void gui_input(Gui* gui, InputEvent* input_event) {
|
||||
gui->ongoing_input_view_port = view_port;
|
||||
}
|
||||
|
||||
if(XTREME_SETTINGS()->left_handed) {
|
||||
switch(input_event->key) {
|
||||
case InputKeyUp:
|
||||
input_event->key = InputKeyDown;
|
||||
break;
|
||||
case InputKeyDown:
|
||||
input_event->key = InputKeyUp;
|
||||
break;
|
||||
case InputKeyLeft:
|
||||
input_event->key = InputKeyRight;
|
||||
break;
|
||||
case InputKeyRight:
|
||||
input_event->key = InputKeyLeft;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(view_port && view_port == gui->ongoing_input_view_port) {
|
||||
view_port_input(view_port, input_event);
|
||||
} else if(gui->ongoing_input_view_port && input_event->type == InputTypeRelease) {
|
||||
|
||||
@@ -42,6 +42,7 @@ void XTREME_SETTINGS_LOAD() {
|
||||
xtreme_settings->butthurt_timer = 43200; // 12 H
|
||||
xtreme_settings->sort_dirs_first = true; // ON
|
||||
xtreme_settings->dark_mode = false; // OFF
|
||||
xtreme_settings->left_handed = false; // OFF
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ typedef struct {
|
||||
int32_t butthurt_timer;
|
||||
bool sort_dirs_first;
|
||||
bool dark_mode;
|
||||
bool left_handed;
|
||||
} XtremeSettings;
|
||||
|
||||
XtremeSettings* XTREME_SETTINGS();
|
||||
|
||||
@@ -117,13 +117,25 @@ static bool subghz_protocol_encoder_came_get_upload(SubGhzProtocolEncoderCame* i
|
||||
instance->encoder.size_upload = size_upload;
|
||||
}
|
||||
//Send header
|
||||
instance->encoder.upload[index++] = level_duration_make(
|
||||
false,
|
||||
(((instance->generic.data_count_bit == CAME_24_COUNT_BIT) ||
|
||||
(instance->generic.data_count_bit ==
|
||||
subghz_protocol_came_const.min_count_bit_for_found)) ?
|
||||
(uint32_t)subghz_protocol_came_const.te_short * 76 :
|
||||
(uint32_t)subghz_protocol_came_const.te_short * 39));
|
||||
// CAME 24 Bit = 24320 us
|
||||
if(instance->generic.data_count_bit == CAME_24_COUNT_BIT) {
|
||||
instance->encoder.upload[index++] =
|
||||
level_duration_make(false, (uint32_t)subghz_protocol_came_const.te_short * 76);
|
||||
} else if(
|
||||
(instance->generic.data_count_bit == subghz_protocol_came_const.min_count_bit_for_found) ||
|
||||
(instance->generic.data_count_bit == AIRFORCE_COUNT_BIT)) {
|
||||
// CAME 12 Bit Original only! and Airforce protocol = 15040 us
|
||||
instance->encoder.upload[index++] =
|
||||
level_duration_make(false, (uint32_t)subghz_protocol_came_const.te_short * 47);
|
||||
} else if(instance->generic.data_count_bit == PRASTEL_COUNT_BIT) {
|
||||
// PRASTEL = 11520 us
|
||||
instance->encoder.upload[index++] =
|
||||
level_duration_make(false, (uint32_t)subghz_protocol_came_const.te_short * 36);
|
||||
} else {
|
||||
// Some wrong detected protocols, 5120 us
|
||||
instance->encoder.upload[index++] =
|
||||
level_duration_make(false, (uint32_t)subghz_protocol_came_const.te_short * 16);
|
||||
}
|
||||
//Send start bit
|
||||
instance->encoder.upload[index++] =
|
||||
level_duration_make(true, (uint32_t)subghz_protocol_came_const.te_short);
|
||||
|
||||
Reference in New Issue
Block a user