This commit is contained in:
Willy-JL
2023-11-19 23:42:25 +00:00
parent 2b71789692
commit 91368a4538
7 changed files with 126 additions and 114 deletions

View File

@@ -1,7 +1,6 @@
#include "hex_viewer_haptic.h" #include "hex_viewer_haptic.h"
#include "../hex_viewer.h" #include "../hex_viewer.h"
void hex_viewer_play_happy_bump(void* context) { void hex_viewer_play_happy_bump(void* context) {
HexViewer* app = context; HexViewer* app = context;
if(app->haptic != 1) { if(app->haptic != 1) {

View File

@@ -5,4 +5,3 @@ void hex_viewer_play_happy_bump(void* context);
void hex_viewer_play_bad_bump(void* context); void hex_viewer_play_bad_bump(void* context);
void hex_viewer_play_long_bump(void* context); void hex_viewer_play_long_bump(void* context);

View File

@@ -1,8 +1,6 @@
#include "hex_viewer_led.h" #include "hex_viewer_led.h"
#include "../hex_viewer.h" #include "../hex_viewer.h"
void hex_viewer_led_set_rgb(void* context, int red, int green, int blue) { void hex_viewer_led_set_rgb(void* context, int red, int green, int blue) {
HexViewer* app = context; HexViewer* app = context;
if(app->led != 1) { if(app->led != 1) {
@@ -26,7 +24,8 @@ void hex_viewer_led_set_rgb(void* context, int red, int green, int blue) {
NULL, NULL,
}; };
notification_message(app->notification, &notification_sequence); notification_message(app->notification, &notification_sequence);
furi_thread_flags_wait(0, FuriFlagWaitAny, 10); //Delay, prevent removal from RAM before LED value set furi_thread_flags_wait(
0, FuriFlagWaitAny, 10); //Delay, prevent removal from RAM before LED value set
} }
void hex_viewer_led_reset(void* context) { void hex_viewer_led_reset(void* context) {
@@ -35,5 +34,6 @@ void hex_viewer_led_reset(void* context) {
notification_message(app->notification, &sequence_reset_green); notification_message(app->notification, &sequence_reset_green);
notification_message(app->notification, &sequence_reset_blue); notification_message(app->notification, &sequence_reset_blue);
furi_thread_flags_wait(0, FuriFlagWaitAny, 300); //Delay, prevent removal from RAM before LED value set furi_thread_flags_wait(
0, FuriFlagWaitAny, 300); //Delay, prevent removal from RAM before LED value set
} }

View File

@@ -3,4 +3,3 @@
void hex_viewer_led_set_rgb(void* context, int red, int green, int blue); void hex_viewer_led_set_rgb(void* context, int red, int green, int blue);
void hex_viewer_led_reset(void* context); void hex_viewer_led_reset(void* context);

View File

@@ -12,7 +12,6 @@ void hex_viewer_play_input_sound(void* context) {
if(furi_hal_speaker_is_mine() || furi_hal_speaker_acquire(30)) { if(furi_hal_speaker_is_mine() || furi_hal_speaker_acquire(30)) {
furi_hal_speaker_start(NOTE_INPUT, volume); furi_hal_speaker_start(NOTE_INPUT, volume);
} }
} }
void hex_viewer_stop_all_sound(void* context) { void hex_viewer_stop_all_sound(void* context) {

View File

@@ -43,7 +43,6 @@ const uint32_t settings_value[2] = {
HexViewerSettingsOn, HexViewerSettingsOn,
}; };
static void hex_viewer_scene_settings_set_haptic(VariableItem* item) { static void hex_viewer_scene_settings_set_haptic(VariableItem* item) {
HexViewer* app = variable_item_get_context(item); HexViewer* app = 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);
@@ -85,33 +84,21 @@ void hex_viewer_scene_settings_on_enter(void* context) {
// Vibro on/off // Vibro on/off
item = variable_item_list_add( item = variable_item_list_add(
app->variable_item_list, app->variable_item_list, "Vibro/Haptic:", 2, hex_viewer_scene_settings_set_haptic, app);
"Vibro/Haptic:",
2,
hex_viewer_scene_settings_set_haptic,
app);
value_index = value_index_uint32(app->haptic, haptic_value, 2); value_index = value_index_uint32(app->haptic, haptic_value, 2);
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, haptic_text[value_index]); variable_item_set_current_value_text(item, haptic_text[value_index]);
// Sound on/off // Sound on/off
item = variable_item_list_add( item = variable_item_list_add(
app->variable_item_list, app->variable_item_list, "Sound:", 2, hex_viewer_scene_settings_set_speaker, app);
"Sound:",
2,
hex_viewer_scene_settings_set_speaker,
app);
value_index = value_index_uint32(app->speaker, speaker_value, 2); value_index = value_index_uint32(app->speaker, speaker_value, 2);
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, speaker_text[value_index]); variable_item_set_current_value_text(item, speaker_text[value_index]);
// LED Effects on/off // LED Effects on/off
item = variable_item_list_add( item = variable_item_list_add(
app->variable_item_list, app->variable_item_list, "LED FX:", 2, hex_viewer_scene_settings_set_led, app);
"LED FX:",
2,
hex_viewer_scene_settings_set_led,
app);
value_index = value_index_uint32(app->led, led_value, 2); value_index = value_index_uint32(app->led, led_value, 2);
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, led_text[value_index]); variable_item_set_current_value_text(item, led_text[value_index]);
@@ -135,7 +122,6 @@ bool hex_viewer_scene_settings_on_event(void* context, SceneManagerEvent event)
UNUSED(app); UNUSED(app);
bool consumed = false; bool consumed = false;
if(event.type == SceneManagerEventTypeCustom) { if(event.type == SceneManagerEventTypeCustom) {
} }
return consumed; return consumed;
} }

View File

@@ -68,7 +68,8 @@ static void hid_ptt_draw_callback(Canvas* canvas, void* context) {
const uint8_t y_os = 88; const uint8_t y_os = 88;
const uint8_t x_os = 7; const uint8_t x_os = 7;
// elements_slightly_rounded_box(canvas, model->is_mac_os ? 0 : 26, y_os, model->is_mac_os ? 21 : 26, 11); // elements_slightly_rounded_box(canvas, model->is_mac_os ? 0 : 26, y_os, model->is_mac_os ? 21 : 26, 11);
elements_slightly_rounded_box(canvas, model->is_mac_os ? x_os : x_os + 26, y_os, model->is_mac_os ? 21 : 26, 11); elements_slightly_rounded_box(
canvas, model->is_mac_os ? x_os : x_os + 26, y_os, model->is_mac_os ? 21 : 26, 11);
canvas_set_color(canvas, model->is_mac_os ? ColorWhite : ColorBlack); canvas_set_color(canvas, model->is_mac_os ? ColorWhite : ColorBlack);
elements_multiline_text_aligned(canvas, x_os + 2, y_os + 1, AlignLeft, AlignTop, "Mac"); elements_multiline_text_aligned(canvas, x_os + 2, y_os + 1, AlignLeft, AlignTop, "Mac");
canvas_set_color(canvas, ColorBlack); canvas_set_color(canvas, ColorBlack);
@@ -175,14 +176,17 @@ static void hid_ptt_draw_callback(Canvas* canvas, void* context) {
canvas_draw_icon(canvas, x_ptt, y_2, &I_BtnFrameLeft_3x18); canvas_draw_icon(canvas, x_ptt, y_2, &I_BtnFrameLeft_3x18);
canvas_draw_icon(canvas, x_ptt + x_ptt_width + 3 + x_ptt_margin, y_2, &I_BtnFrameRight_2x18); canvas_draw_icon(canvas, x_ptt + x_ptt_width + 3 + x_ptt_margin, y_2, &I_BtnFrameRight_2x18);
canvas_draw_line(canvas, x_ptt + 3, y_2, x_ptt + x_ptt_width + 2 + x_ptt_margin, y_2); canvas_draw_line(canvas, x_ptt + 3, y_2, x_ptt + x_ptt_width + 2 + x_ptt_margin, y_2);
canvas_draw_line(canvas, x_ptt + 3 , y_2 + 16, x_ptt + x_ptt_width + 2 + x_ptt_margin, y_2 + 16); canvas_draw_line(
canvas_draw_line(canvas, x_ptt + 3 , y_2 + 17, x_ptt + x_ptt_width + 2 + x_ptt_margin, y_2 + 17); canvas, x_ptt + 3, y_2 + 16, x_ptt + x_ptt_width + 2 + x_ptt_margin, y_2 + 16);
canvas_draw_line(
canvas, x_ptt + 3, y_2 + 17, x_ptt + x_ptt_width + 2 + x_ptt_margin, y_2 + 17);
if(model->ptt_pressed) { if(model->ptt_pressed) {
elements_slightly_rounded_box(canvas, x_ptt + 3, y_2 + 2, x_ptt_width + x_ptt_margin, 13); elements_slightly_rounded_box(canvas, x_ptt + 3, y_2 + 2, x_ptt_width + x_ptt_margin, 13);
canvas_set_color(canvas, ColorWhite); canvas_set_color(canvas, ColorWhite);
} }
canvas_set_font(canvas, FontPrimary); canvas_set_font(canvas, FontPrimary);
elements_multiline_text_aligned(canvas, x_ptt + 2 + x_ptt_margin / 2, y_2 + 13, AlignLeft, AlignBottom, "PTT"); elements_multiline_text_aligned(
canvas, x_ptt + 2 + x_ptt_margin / 2, y_2 + 13, AlignLeft, AlignBottom, "PTT");
canvas_set_font(canvas, FontSecondary); canvas_set_font(canvas, FontSecondary);
} }
@@ -194,14 +198,20 @@ static void hid_ptt_trigger_mute(HidPtt* hid_ptt, HidPttModel * model) {
hid_hal_keyboard_press(hid_ptt->hid, KEY_MOD_LEFT_CTRL | HID_KEYBOARD_D); hid_hal_keyboard_press(hid_ptt->hid, KEY_MOD_LEFT_CTRL | HID_KEYBOARD_D);
hid_hal_keyboard_release(hid_ptt->hid, KEY_MOD_LEFT_CTRL | HID_KEYBOARD_D); hid_hal_keyboard_release(hid_ptt->hid, KEY_MOD_LEFT_CTRL | HID_KEYBOARD_D);
} else if(model->appIndex == HidPttAppIndexZoom && model->is_mac_os) { } else if(model->appIndex == HidPttAppIndexZoom && model->is_mac_os) {
hid_hal_keyboard_press( hid_ptt->hid, KEY_MOD_LEFT_GUI| KEY_MOD_LEFT_SHIFT | HID_KEYBOARD_A); hid_hal_keyboard_press(
hid_hal_keyboard_release(hid_ptt->hid, KEY_MOD_LEFT_GUI| KEY_MOD_LEFT_SHIFT | HID_KEYBOARD_A ); hid_ptt->hid, KEY_MOD_LEFT_GUI | KEY_MOD_LEFT_SHIFT | HID_KEYBOARD_A);
hid_hal_keyboard_release(
hid_ptt->hid, KEY_MOD_LEFT_GUI | KEY_MOD_LEFT_SHIFT | HID_KEYBOARD_A);
} else if(model->appIndex == HidPttAppIndexFaceTime) { } else if(model->appIndex == HidPttAppIndexFaceTime) {
hid_hal_keyboard_press( hid_ptt->hid, KEY_MOD_LEFT_GUI| KEY_MOD_LEFT_SHIFT | HID_KEYBOARD_M); hid_hal_keyboard_press(
hid_hal_keyboard_release(hid_ptt->hid, KEY_MOD_LEFT_GUI| KEY_MOD_LEFT_SHIFT | HID_KEYBOARD_M ); hid_ptt->hid, KEY_MOD_LEFT_GUI | KEY_MOD_LEFT_SHIFT | HID_KEYBOARD_M);
hid_hal_keyboard_release(
hid_ptt->hid, KEY_MOD_LEFT_GUI | KEY_MOD_LEFT_SHIFT | HID_KEYBOARD_M);
} else if(model->appIndex == HidPttAppIndexSkype && model->is_mac_os) { } else if(model->appIndex == HidPttAppIndexSkype && model->is_mac_os) {
hid_hal_keyboard_press( hid_ptt->hid, KEY_MOD_LEFT_GUI| KEY_MOD_LEFT_SHIFT | HID_KEYBOARD_M); hid_hal_keyboard_press(
hid_hal_keyboard_release(hid_ptt->hid, KEY_MOD_LEFT_GUI| KEY_MOD_LEFT_SHIFT | HID_KEYBOARD_M ); hid_ptt->hid, KEY_MOD_LEFT_GUI | KEY_MOD_LEFT_SHIFT | HID_KEYBOARD_M);
hid_hal_keyboard_release(
hid_ptt->hid, KEY_MOD_LEFT_GUI | KEY_MOD_LEFT_SHIFT | HID_KEYBOARD_M);
} else if(model->appIndex == HidPttAppIndexSkype && !model->is_mac_os) { } else if(model->appIndex == HidPttAppIndexSkype && !model->is_mac_os) {
hid_hal_keyboard_press(hid_ptt->hid, KEY_MOD_LEFT_CTRL | HID_KEYBOARD_M); hid_hal_keyboard_press(hid_ptt->hid, KEY_MOD_LEFT_CTRL | HID_KEYBOARD_M);
hid_hal_keyboard_release(hid_ptt->hid, KEY_MOD_LEFT_CTRL | HID_KEYBOARD_M); hid_hal_keyboard_release(hid_ptt->hid, KEY_MOD_LEFT_CTRL | HID_KEYBOARD_M);
@@ -216,17 +226,23 @@ static void hid_ptt_trigger_camera(HidPtt* hid_ptt, HidPttModel * model) {
hid_hal_keyboard_press(hid_ptt->hid, KEY_MOD_LEFT_CTRL | HID_KEYBOARD_E); hid_hal_keyboard_press(hid_ptt->hid, KEY_MOD_LEFT_CTRL | HID_KEYBOARD_E);
hid_hal_keyboard_release(hid_ptt->hid, KEY_MOD_LEFT_CTRL | HID_KEYBOARD_E); hid_hal_keyboard_release(hid_ptt->hid, KEY_MOD_LEFT_CTRL | HID_KEYBOARD_E);
} else if(model->appIndex == HidPttAppIndexZoom && model->is_mac_os) { } else if(model->appIndex == HidPttAppIndexZoom && model->is_mac_os) {
hid_hal_keyboard_press( hid_ptt->hid, KEY_MOD_LEFT_GUI| KEY_MOD_LEFT_SHIFT | HID_KEYBOARD_V); hid_hal_keyboard_press(
hid_hal_keyboard_release(hid_ptt->hid, KEY_MOD_LEFT_GUI| KEY_MOD_LEFT_SHIFT | HID_KEYBOARD_V ); hid_ptt->hid, KEY_MOD_LEFT_GUI | KEY_MOD_LEFT_SHIFT | HID_KEYBOARD_V);
hid_hal_keyboard_release(
hid_ptt->hid, KEY_MOD_LEFT_GUI | KEY_MOD_LEFT_SHIFT | HID_KEYBOARD_V);
} else if(model->appIndex == HidPttAppIndexZoom && !model->is_mac_os) { } else if(model->appIndex == HidPttAppIndexZoom && !model->is_mac_os) {
hid_hal_keyboard_press(hid_ptt->hid, KEY_MOD_LEFT_ALT | HID_KEYBOARD_V); hid_hal_keyboard_press(hid_ptt->hid, KEY_MOD_LEFT_ALT | HID_KEYBOARD_V);
hid_hal_keyboard_release(hid_ptt->hid, KEY_MOD_LEFT_ALT | HID_KEYBOARD_V); hid_hal_keyboard_release(hid_ptt->hid, KEY_MOD_LEFT_ALT | HID_KEYBOARD_V);
} else if(model->appIndex == HidPttAppIndexSkype && model->is_mac_os) { } else if(model->appIndex == HidPttAppIndexSkype && model->is_mac_os) {
hid_hal_keyboard_press( hid_ptt->hid, KEY_MOD_LEFT_GUI| KEY_MOD_LEFT_SHIFT | HID_KEYBOARD_K); hid_hal_keyboard_press(
hid_hal_keyboard_release(hid_ptt->hid, KEY_MOD_LEFT_GUI| KEY_MOD_LEFT_SHIFT | HID_KEYBOARD_K ); hid_ptt->hid, KEY_MOD_LEFT_GUI | KEY_MOD_LEFT_SHIFT | HID_KEYBOARD_K);
hid_hal_keyboard_release(
hid_ptt->hid, KEY_MOD_LEFT_GUI | KEY_MOD_LEFT_SHIFT | HID_KEYBOARD_K);
} else if(model->appIndex == HidPttAppIndexSkype && !model->is_mac_os) { } else if(model->appIndex == HidPttAppIndexSkype && !model->is_mac_os) {
hid_hal_keyboard_press( hid_ptt->hid, KEY_MOD_LEFT_CTRL| KEY_MOD_LEFT_SHIFT | HID_KEYBOARD_K); hid_hal_keyboard_press(
hid_hal_keyboard_release(hid_ptt->hid, KEY_MOD_LEFT_CTRL| KEY_MOD_LEFT_SHIFT | HID_KEYBOARD_K ); hid_ptt->hid, KEY_MOD_LEFT_CTRL | KEY_MOD_LEFT_SHIFT | HID_KEYBOARD_K);
hid_hal_keyboard_release(
hid_ptt->hid, KEY_MOD_LEFT_CTRL | KEY_MOD_LEFT_SHIFT | HID_KEYBOARD_K);
} }
} }
@@ -236,11 +252,15 @@ static void hid_ptt_start_ptt(HidPtt* hid_ptt, HidPttModel * model) {
} else if(model->appIndex == HidPttAppIndexZoom) { } else if(model->appIndex == HidPttAppIndexZoom) {
hid_hal_keyboard_press(hid_ptt->hid, HID_KEYBOARD_SPACEBAR); hid_hal_keyboard_press(hid_ptt->hid, HID_KEYBOARD_SPACEBAR);
} else if(model->appIndex == HidPttAppIndexFaceTime) { } else if(model->appIndex == HidPttAppIndexFaceTime) {
hid_hal_keyboard_press( hid_ptt->hid, KEY_MOD_LEFT_GUI| KEY_MOD_LEFT_SHIFT | HID_KEYBOARD_M); hid_hal_keyboard_press(
hid_hal_keyboard_release(hid_ptt->hid, KEY_MOD_LEFT_GUI| KEY_MOD_LEFT_SHIFT | HID_KEYBOARD_M ); hid_ptt->hid, KEY_MOD_LEFT_GUI | KEY_MOD_LEFT_SHIFT | HID_KEYBOARD_M);
hid_hal_keyboard_release(
hid_ptt->hid, KEY_MOD_LEFT_GUI | KEY_MOD_LEFT_SHIFT | HID_KEYBOARD_M);
} else if(model->appIndex == HidPttAppIndexSkype && model->is_mac_os) { } else if(model->appIndex == HidPttAppIndexSkype && model->is_mac_os) {
hid_hal_keyboard_press( hid_ptt->hid, KEY_MOD_LEFT_GUI| KEY_MOD_LEFT_SHIFT | HID_KEYBOARD_M); hid_hal_keyboard_press(
hid_hal_keyboard_release(hid_ptt->hid, KEY_MOD_LEFT_GUI| KEY_MOD_LEFT_SHIFT | HID_KEYBOARD_M ); hid_ptt->hid, KEY_MOD_LEFT_GUI | KEY_MOD_LEFT_SHIFT | HID_KEYBOARD_M);
hid_hal_keyboard_release(
hid_ptt->hid, KEY_MOD_LEFT_GUI | KEY_MOD_LEFT_SHIFT | HID_KEYBOARD_M);
} else if(model->appIndex == HidPttAppIndexSkype && !model->is_mac_os) { } else if(model->appIndex == HidPttAppIndexSkype && !model->is_mac_os) {
hid_hal_keyboard_press(hid_ptt->hid, KEY_MOD_LEFT_CTRL | HID_KEYBOARD_M); hid_hal_keyboard_press(hid_ptt->hid, KEY_MOD_LEFT_CTRL | HID_KEYBOARD_M);
hid_hal_keyboard_release(hid_ptt->hid, KEY_MOD_LEFT_CTRL | HID_KEYBOARD_M); hid_hal_keyboard_release(hid_ptt->hid, KEY_MOD_LEFT_CTRL | HID_KEYBOARD_M);
@@ -253,11 +273,15 @@ static void hid_ptt_stop_ptt(HidPtt* hid_ptt, HidPttModel * model) {
} else if(model->appIndex == HidPttAppIndexZoom) { } else if(model->appIndex == HidPttAppIndexZoom) {
hid_hal_keyboard_release(hid_ptt->hid, HID_KEYBOARD_SPACEBAR); hid_hal_keyboard_release(hid_ptt->hid, HID_KEYBOARD_SPACEBAR);
} else if(model->appIndex == HidPttAppIndexFaceTime) { } else if(model->appIndex == HidPttAppIndexFaceTime) {
hid_hal_keyboard_press( hid_ptt->hid, KEY_MOD_LEFT_GUI| KEY_MOD_LEFT_SHIFT | HID_KEYBOARD_M); hid_hal_keyboard_press(
hid_hal_keyboard_release(hid_ptt->hid, KEY_MOD_LEFT_GUI| KEY_MOD_LEFT_SHIFT | HID_KEYBOARD_M ); hid_ptt->hid, KEY_MOD_LEFT_GUI | KEY_MOD_LEFT_SHIFT | HID_KEYBOARD_M);
hid_hal_keyboard_release(
hid_ptt->hid, KEY_MOD_LEFT_GUI | KEY_MOD_LEFT_SHIFT | HID_KEYBOARD_M);
} else if(model->appIndex == HidPttAppIndexSkype && model->is_mac_os) { } else if(model->appIndex == HidPttAppIndexSkype && model->is_mac_os) {
hid_hal_keyboard_press( hid_ptt->hid, KEY_MOD_LEFT_GUI| KEY_MOD_LEFT_SHIFT | HID_KEYBOARD_M); hid_hal_keyboard_press(
hid_hal_keyboard_release(hid_ptt->hid, KEY_MOD_LEFT_GUI| KEY_MOD_LEFT_SHIFT | HID_KEYBOARD_M ); hid_ptt->hid, KEY_MOD_LEFT_GUI | KEY_MOD_LEFT_SHIFT | HID_KEYBOARD_M);
hid_hal_keyboard_release(
hid_ptt->hid, KEY_MOD_LEFT_GUI | KEY_MOD_LEFT_SHIFT | HID_KEYBOARD_M);
} else if(model->appIndex == HidPttAppIndexSkype && !model->is_mac_os) { } else if(model->appIndex == HidPttAppIndexSkype && !model->is_mac_os) {
hid_hal_keyboard_press(hid_ptt->hid, KEY_MOD_LEFT_CTRL | HID_KEYBOARD_M); hid_hal_keyboard_press(hid_ptt->hid, KEY_MOD_LEFT_CTRL | HID_KEYBOARD_M);
hid_hal_keyboard_release(hid_ptt->hid, KEY_MOD_LEFT_CTRL | HID_KEYBOARD_M); hid_hal_keyboard_release(hid_ptt->hid, KEY_MOD_LEFT_CTRL | HID_KEYBOARD_M);
@@ -293,7 +317,8 @@ static void hid_ptt_process(HidPtt* hid_ptt, InputEvent* event) {
} else { } else {
if(model->appIndex != HidPttAppIndexFaceTime) { if(model->appIndex != HidPttAppIndexFaceTime) {
model->is_mac_os = !model->is_mac_os; model->is_mac_os = !model->is_mac_os;
notification_message(hid_ptt->hid->notifications, &sequence_single_vibro); notification_message(
hid_ptt->hid->notifications, &sequence_single_vibro);
} }
} }
} else if(event->key == InputKeyDown) { } else if(event->key == InputKeyDown) {
@@ -352,7 +377,8 @@ static void hid_ptt_process(HidPtt* hid_ptt, InputEvent* event) {
model->mic_pressed = false; model->mic_pressed = false;
} }
} else if(event->type == InputTypeShort) { } else if(event->type == InputTypeShort) {
if(event->key == InputKeyBack && !model->ptt_pressed ) { // no changes if PTT is pressed if(event->key == InputKeyBack &&
!model->ptt_pressed) { // no changes if PTT is pressed
model->muted = !model->muted; model->muted = !model->muted;
hid_ptt_trigger_mute(hid_ptt, model); hid_ptt_trigger_mute(hid_ptt, model);
} else if(event->key == InputKeyRight) { } else if(event->key == InputKeyRight) {
@@ -365,7 +391,8 @@ static void hid_ptt_process(HidPtt* hid_ptt, InputEvent* event) {
model->left_pressed = false; model->left_pressed = false;
if(!model->ptt_pressed) { if(!model->ptt_pressed) {
hid_hal_keyboard_release_all(hid_ptt->hid); hid_hal_keyboard_release_all(hid_ptt->hid);
view_dispatcher_switch_to_view(hid_ptt->hid->view_dispatcher, HidViewSubmenu); view_dispatcher_switch_to_view(
hid_ptt->hid->view_dispatcher, HidViewSubmenu);
// sequence_double_vibro to notify that we quit PTT // sequence_double_vibro to notify that we quit PTT
notification_message(hid_ptt->hid->notifications, &sequence_double_vibro); notification_message(hid_ptt->hid->notifications, &sequence_double_vibro);
} }
@@ -404,11 +431,14 @@ HidPtt* hid_ptt_alloc(Hid* hid) {
view_set_orientation(hid_ptt->view, ViewOrientationVerticalFlip); view_set_orientation(hid_ptt->view, ViewOrientationVerticalFlip);
with_view_model( with_view_model(
hid_ptt->view, HidPttModel * model, { hid_ptt->view,
HidPttModel * model,
{
model->transport = hid->transport; model->transport = hid->transport;
model->muted = true; // assume we're muted model->muted = true; // assume we're muted
model->is_mac_os = true; model->is_mac_os = true;
}, true); },
true);
return hid_ptt; return hid_ptt;
} }