Просмотр исходного кода

Merge pull request #28 from hryamzik/ptt

PTT: redesigned hotkeys to ignore any keys when PTT pressed
MMX 2 лет назад
Родитель
Сommit
d490477ce0

+ 2 - 31
base_pack/hid_app/hid.c

@@ -83,28 +83,11 @@ static void bt_hid_connection_status_changed_callback(BtStatus status, void* con
     hid_tikshorts_set_connected_status(hid->hid_tikshorts, connected);
     hid_tikshorts_set_connected_status(hid->hid_tikshorts, connected);
 }
 }
 
 
-static void hid_dialog_callback(DialogExResult result, void* context) {
-    furi_assert(context);
-    Hid* app = context;
-    if(result == DialogExResultLeft) {
-        view_dispatcher_stop(app->view_dispatcher);
-    } else if(result == DialogExResultRight) {
-        view_dispatcher_switch_to_view(app->view_dispatcher, app->view_id); // Show last view
-    } else if(result == DialogExResultCenter) {
-        view_dispatcher_switch_to_view(app->view_dispatcher, HidViewSubmenu);
-    }
-}
-
 static uint32_t hid_menu_view(void* context) {
 static uint32_t hid_menu_view(void* context) {
     UNUSED(context);
     UNUSED(context);
     return HidViewSubmenu;
     return HidViewSubmenu;
 }
 }
 
 
-static uint32_t hid_exit_confirm_view(void* context) {
-    UNUSED(context);
-    return HidViewExitConfirm;
-}
-
 static uint32_t hid_exit(void* context) {
 static uint32_t hid_exit(void* context) {
     UNUSED(context);
     UNUSED(context);
     return VIEW_NONE;
     return VIEW_NONE;
@@ -180,16 +163,6 @@ Hid* hid_alloc(HidTransport transport) {
 Hid* hid_app_alloc_view(void* context) {
 Hid* hid_app_alloc_view(void* context) {
     furi_assert(context);
     furi_assert(context);
     Hid* app = context;
     Hid* app = context;
-    // Dialog view
-    app->dialog = dialog_ex_alloc();
-    dialog_ex_set_result_callback(app->dialog, hid_dialog_callback);
-    dialog_ex_set_context(app->dialog, app);
-    dialog_ex_set_left_button_text(app->dialog, "Exit");
-    dialog_ex_set_right_button_text(app->dialog, "Stay");
-    dialog_ex_set_center_button_text(app->dialog, "Menu");
-    dialog_ex_set_header(app->dialog, "Close Current App?", 16, 12, AlignLeft, AlignTop);
-    view_dispatcher_add_view(
-        app->view_dispatcher, HidViewExitConfirm, dialog_ex_get_view(app->dialog));
 
 
     // Keynote view
     // Keynote view
     app->hid_keynote = hid_keynote_alloc(app);
     app->hid_keynote = hid_keynote_alloc(app);
@@ -223,13 +196,13 @@ Hid* hid_app_alloc_view(void* context) {
 
 
     // TikTok / YT Shorts view
     // TikTok / YT Shorts view
     app->hid_tikshorts = hid_tikshorts_alloc(app);
     app->hid_tikshorts = hid_tikshorts_alloc(app);
-    view_set_previous_callback(hid_tikshorts_get_view(app->hid_tikshorts), hid_exit_confirm_view);
+    view_set_previous_callback(hid_tikshorts_get_view(app->hid_tikshorts), hid_menu_view);
     view_dispatcher_add_view(
     view_dispatcher_add_view(
         app->view_dispatcher, BtHidViewTikShorts, hid_tikshorts_get_view(app->hid_tikshorts));
         app->view_dispatcher, BtHidViewTikShorts, hid_tikshorts_get_view(app->hid_tikshorts));
 
 
     // Mouse view
     // Mouse view
     app->hid_mouse = hid_mouse_alloc(app);
     app->hid_mouse = hid_mouse_alloc(app);
-    view_set_previous_callback(hid_mouse_get_view(app->hid_mouse), hid_exit_confirm_view);
+    view_set_previous_callback(hid_mouse_get_view(app->hid_mouse), hid_menu_view);
     view_dispatcher_add_view(
     view_dispatcher_add_view(
         app->view_dispatcher, HidViewMouse, hid_mouse_get_view(app->hid_mouse));
         app->view_dispatcher, HidViewMouse, hid_mouse_get_view(app->hid_mouse));
 
 
@@ -271,8 +244,6 @@ void hid_free(Hid* app) {
     // Free views
     // Free views
     view_dispatcher_remove_view(app->view_dispatcher, HidViewSubmenu);
     view_dispatcher_remove_view(app->view_dispatcher, HidViewSubmenu);
     submenu_free(app->device_type_submenu);
     submenu_free(app->device_type_submenu);
-    view_dispatcher_remove_view(app->view_dispatcher, HidViewExitConfirm);
-    dialog_ex_free(app->dialog);
     view_dispatcher_remove_view(app->view_dispatcher, HidViewKeynote);
     view_dispatcher_remove_view(app->view_dispatcher, HidViewKeynote);
     hid_keynote_free(app->hid_keynote);
     hid_keynote_free(app->hid_keynote);
     view_dispatcher_remove_view(app->view_dispatcher, HidViewKeyboard);
     view_dispatcher_remove_view(app->view_dispatcher, HidViewKeyboard);

+ 1 - 1
base_pack/hid_app/hid.h

@@ -22,8 +22,8 @@
 #include "views/hid_media.h"
 #include "views/hid_media.h"
 #include "views/hid_movie.h"
 #include "views/hid_movie.h"
 #include "views/hid_mouse.h"
 #include "views/hid_mouse.h"
-#include "views/hid_mouse_jiggler.h"
 #include "views/hid_mouse_clicker.h"
 #include "views/hid_mouse_clicker.h"
+#include "views/hid_mouse_jiggler.h"
 #include "views/hid_tikshorts.h"
 #include "views/hid_tikshorts.h"
 #include "views/hid_ptt.h"
 #include "views/hid_ptt.h"
 
 

+ 0 - 1
base_pack/hid_app/views.h

@@ -10,5 +10,4 @@ typedef enum {
     HidViewMouseJiggler,
     HidViewMouseJiggler,
     BtHidViewTikShorts,
     BtHidViewTikShorts,
     HidViewPtt,
     HidViewPtt,
-    HidViewExitConfirm,
 } HidView;
 } HidView;

+ 8 - 5
base_pack/hid_app/views/hid_media.c

@@ -188,12 +188,15 @@ static bool hid_media_input_callback(InputEvent* event, void* context) {
     HidMedia* hid_media = context;
     HidMedia* hid_media = context;
     bool consumed = false;
     bool consumed = false;
 
 
-    if(event->type == InputTypePress) {
-        hid_media_process_press(hid_media, event);
-        consumed = true;
-    } else if(event->type == InputTypeRelease) {
-        hid_media_process_release(hid_media, event);
+    if(event->type == InputTypeLong && event->key == InputKeyBack) {
+        hid_hal_keyboard_release_all(hid_media->hid);
+    } else {
         consumed = true;
         consumed = true;
+        if(event->type == InputTypePress) {
+            hid_media_process_press(hid_media, event);
+        } else if(event->type == InputTypeRelease) {
+            hid_media_process_release(hid_media, event);
+        }
     }
     }
     return consumed;
     return consumed;
 }
 }

+ 11 - 5
base_pack/hid_app/views/hid_movie.c

@@ -186,13 +186,19 @@ static bool hid_movie_input_callback(InputEvent* event, void* context) {
     HidMovie* hid_movie = context;
     HidMovie* hid_movie = context;
     bool consumed = false;
     bool consumed = false;
 
 
-    if(event->type == InputTypePress) {
-        hid_movie_process_press(hid_movie, event);
-        consumed = true;
-    } else if(event->type == InputTypeRelease) {
-        hid_movie_process_release(hid_movie, event);
+    if(event->type == InputTypeLong && event->key == InputKeyBack) {
+        hid_hal_keyboard_release_all(hid_movie->hid);
+    } else {
         consumed = true;
         consumed = true;
+        if(event->type == InputTypePress) {
+            hid_movie_process_press(hid_movie, event);
+            consumed = true;
+        } else if(event->type == InputTypeRelease) {
+            hid_movie_process_release(hid_movie, event);
+            consumed = true;
+        }
     }
     }
+
     return consumed;
     return consumed;
 }
 }
 
 

+ 123 - 94
base_pack/hid_app/views/hid_ptt.c

@@ -21,6 +21,7 @@ typedef struct {
     bool muted;
     bool muted;
     bool ptt_pressed;
     bool ptt_pressed;
     bool mic_pressed;
     bool mic_pressed;
+    bool mic_sync_pressed;
     bool connected;
     bool connected;
     bool is_mac_os;
     bool is_mac_os;
     uint32_t appIndex;
     uint32_t appIndex;
@@ -81,8 +82,9 @@ static void hid_ptt_draw_callback(Canvas* canvas, void* context) {
 
 
     // Mic label
     // Mic label
     const uint8_t y_mic = 102;
     const uint8_t y_mic = 102;
-    canvas_draw_icon(canvas, 19, y_mic - 1, &I_Pin_back_arrow_rotated_8x10);
-    elements_multiline_text_aligned(canvas, 0, y_mic, AlignLeft, AlignTop, "Hold      to sync");
+    canvas_draw_icon(canvas, 0, y_mic - 1, &I_Pin_back_arrow_rotated_8x10);
+    canvas_draw_icon(canvas, 18, y_mic - 1, &I_Ok_btn_9x9);
+    elements_multiline_text_aligned(canvas, 11, y_mic, AlignLeft, AlignTop, "+      to sync");
     elements_multiline_text_aligned(canvas, 20, y_mic+10, AlignLeft, AlignTop, "mic status");
     elements_multiline_text_aligned(canvas, 20, y_mic+10, AlignLeft, AlignTop, "mic status");
 
 
     // Exit label
     // Exit label
@@ -96,71 +98,73 @@ static void hid_ptt_draw_callback(Canvas* canvas, void* context) {
     const uint8_t y_1 = 19;
     const uint8_t y_1 = 19;
     const uint8_t y_2 = y_1 + 19;
     const uint8_t y_2 = y_1 + 19;
     const uint8_t y_3 = y_2 + 19;
     const uint8_t y_3 = y_2 + 19;
-
-    // Up
-    canvas_draw_icon(canvas, x_2, y_1, &I_Button_18x18);
-    if(model->up_pressed) {
-        elements_slightly_rounded_box(canvas, x_2 + 3, y_1 + 2, 13, 13);
-        canvas_set_color(canvas, ColorWhite);
-    }
-    if(model->ptt_pressed) {
-        if (model->appIndex != HidPttAppIndexFaceTime) {
-            elements_multiline_text_aligned(canvas, x_2 + 4, y_1 + 5, AlignLeft, AlignTop, "OS");
+    if(!model->ptt_pressed || model->mic_pressed || model->up_pressed || model->down_pressed || model->left_pressed || model->right_pressed || model->mic_sync_pressed) {
+        // Up
+        canvas_draw_icon(canvas, x_2, y_1, &I_Button_18x18);
+        if(model->up_pressed) {
+            elements_slightly_rounded_box(canvas, x_2 + 3, y_1 + 2, 13, 13);
+            canvas_set_color(canvas, ColorWhite);
         }
         }
-    } else {
-        canvas_draw_icon(canvas, x_2 + 5, y_1 + 5, &I_Volup_8x6);
-    }
-    canvas_set_color(canvas, ColorBlack);
+        if(model->mic_pressed) {
+            if (model->appIndex != HidPttAppIndexFaceTime) {
+                elements_multiline_text_aligned(canvas, x_2 + 4, y_1 + 5, AlignLeft, AlignTop, "OS");
+            }
+        } else {
+            canvas_draw_icon(canvas, x_2 + 5, y_1 + 5, &I_Volup_8x6);
+        }
+        canvas_set_color(canvas, ColorBlack);
 
 
-    // Down
-    canvas_draw_icon(canvas, x_2, y_3, &I_Button_18x18);
-    if(model->down_pressed) {
-        elements_slightly_rounded_box(canvas, x_2 + 3, y_3 + 2, 13, 13);
-        canvas_set_color(canvas, ColorWhite);
-    }
-    if(!model->ptt_pressed) {
-        canvas_draw_icon(canvas, x_2 + 6, y_3 + 5, &I_Voldwn_6x6);
-    }
-    canvas_set_color(canvas, ColorBlack);
+        // Down
+        canvas_draw_icon(canvas, x_2, y_3, &I_Button_18x18);
+        if(model->down_pressed) {
+            elements_slightly_rounded_box(canvas, x_2 + 3, y_3 + 2, 13, 13);
+            canvas_set_color(canvas, ColorWhite);
+        }
+        if(!model->mic_pressed) {
+            canvas_draw_icon(canvas, x_2 + 6, y_3 + 5, &I_Voldwn_6x6);
+        }
+        canvas_set_color(canvas, ColorBlack);
 
 
-    // Left
-    canvas_draw_icon(canvas, x_1, y_2, &I_Button_18x18);
-    if(model->left_pressed) {                                             
-        elements_slightly_rounded_box(canvas, x_1 + 3, y_2 + 2, 13, 13);
-        canvas_set_color(canvas, ColorWhite);
-    }
-    if (model->ptt_pressed) {
-        canvas_draw_icon(canvas, x_1 + 7, y_2 + 5, &I_ButtonLeft_4x7);
-    } else {  
-        canvas_draw_icon(canvas, x_1 + 4, y_2 + 5, &I_Pin_back_arrow_10x8);
-    }
-    canvas_set_color(canvas, ColorBlack);
+        // Left
+        canvas_draw_icon(canvas, x_1, y_2, &I_Button_18x18);
+        if(model->left_pressed) {                                             
+            elements_slightly_rounded_box(canvas, x_1 + 3, y_2 + 2, 13, 13);
+            canvas_set_color(canvas, ColorWhite);
+        }
+        if (model->mic_pressed) {
+            canvas_draw_icon(canvas, x_1 + 7, y_2 + 5, &I_ButtonLeft_4x7);
+        } else {  
+            canvas_draw_icon(canvas, x_1 + 4, y_2 + 5, &I_Pin_back_arrow_10x8);
+        }
+        canvas_set_color(canvas, ColorBlack);
 
 
-    // Right / Camera
-    canvas_draw_icon(canvas, x_3, y_2, &I_Button_18x18);
-    if(model->right_pressed) {
-        elements_slightly_rounded_box(canvas, x_3 + 3, y_2 + 2, 13, 13);
-        canvas_set_color(canvas, ColorWhite);
-    }
-    if(!model->ptt_pressed) {
-        if (model->appIndex != HidPttAppIndexFaceTime) {
-            canvas_draw_icon(canvas, x_3 + 11, y_2 + 5, &I_ButtonLeft_4x7);
-            canvas_draw_box(canvas, x_3 + 4, y_2 + 5, 7, 7);
+        // Right / Camera
+        canvas_draw_icon(canvas, x_3, y_2, &I_Button_18x18);
+        if(model->right_pressed) {
+            elements_slightly_rounded_box(canvas, x_3 + 3, y_2 + 2, 13, 13);
+            canvas_set_color(canvas, ColorWhite);
         }
         }
-    } else {
-        canvas_draw_icon(canvas, x_3 + 8, y_2 + 5, &I_ButtonRight_4x7);
-    }
-    canvas_set_color(canvas, ColorBlack);
+        if(!model->mic_pressed) {
+            if (model->appIndex != HidPttAppIndexFaceTime) {
+                canvas_draw_icon(canvas, x_3 + 11, y_2 + 5, &I_ButtonLeft_4x7);
+                canvas_draw_box(canvas, x_3 + 4, y_2 + 5, 7, 7);
+            }
+        } else {
+            canvas_draw_icon(canvas, x_3 + 8, y_2 + 5, &I_ButtonRight_4x7);
+        }
+        canvas_set_color(canvas, ColorBlack);
 
 
+    }
     // Back / Mic
     // Back / Mic
     const uint8_t x_mic = x_3;
     const uint8_t x_mic = x_3;
     canvas_draw_icon(canvas, x_mic, 0, &I_Button_18x18);
     canvas_draw_icon(canvas, x_mic, 0, &I_Button_18x18);
     if(model->mic_pressed) {
     if(model->mic_pressed) {
-        elements_slightly_rounded_box(canvas, x_mic + 3, 0 + 2, 13, 13);
+        elements_slightly_rounded_box(canvas, x_mic + 3, 2, 13, 13);
         canvas_set_color(canvas, ColorWhite);
         canvas_set_color(canvas, ColorWhite);
     }
     }
-    canvas_draw_icon(canvas, x_mic + 5, 0 + 4, &I_Mic_btn_8x10);
-    if(model->muted && !model->ptt_pressed) {
+    canvas_draw_icon(canvas, x_mic + 5, 4, &I_Mic_btn_8x10);
+    
+    if (!(!model->muted || (model->ptt_pressed && !model->mic_sync_pressed))) {
         canvas_draw_line(canvas, x_mic + 3, 2     , x_mic + 3 + 13, 2 + 13);
         canvas_draw_line(canvas, x_mic + 3, 2     , x_mic + 3 + 13, 2 + 13);
         canvas_draw_line(canvas, x_mic + 2, 2     , x_mic + 2 + 13, 2 + 13);
         canvas_draw_line(canvas, x_mic + 2, 2     , x_mic + 2 + 13, 2 + 13);
         canvas_draw_line(canvas, x_mic + 3, 2 + 13, x_mic + 3 + 13, 2);
         canvas_draw_line(canvas, x_mic + 3, 2 + 13, x_mic + 3 + 13, 2);
@@ -177,13 +181,33 @@ static void hid_ptt_draw_callback(Canvas* canvas, void* context) {
     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, 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);
     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) {
-        elements_slightly_rounded_box(canvas, x_ptt + 3, y_2 + 2, x_ptt_width + x_ptt_margin, 13);
+
+    if (!model->ptt_pressed && !model->muted && model->mic_pressed) {
+        elements_slightly_rounded_box(canvas, x_ptt + 3, y_2 + 2, (x_ptt_width + x_ptt_margin) / 2, 13);
         canvas_set_color(canvas, ColorWhite);
         canvas_set_color(canvas, ColorWhite);
     }
     }
-    canvas_set_font(canvas, FontPrimary);
-    elements_multiline_text_aligned(canvas, x_ptt + 2 + x_ptt_margin / 2, y_2 + 13, AlignLeft, AlignBottom, "PTT");
-    canvas_set_font(canvas, FontSecondary);
+    if (model->mic_pressed) {
+        canvas_draw_icon(canvas, x_ptt + 4, y_2 + 4, &I_Mic_btn_8x10);
+    }
+    canvas_set_color(canvas, ColorBlack);
+    if(!model->ptt_pressed && model->muted && model->mic_pressed) {
+        elements_slightly_rounded_box(canvas, x_ptt + 3 + (x_ptt_width + x_ptt_margin) / 2, y_2 + 2, (x_ptt_width + x_ptt_margin) / 2, 13);
+        canvas_set_color(canvas, ColorWhite);
+    }
+    if (model->mic_pressed) {
+        canvas_draw_icon(canvas, x_ptt + 14, y_2 + 4, &I_Mic_btn_8x10);
+        canvas_draw_line(canvas, x_ptt + 13, y_2 + 3 , x_ptt + 22, y_2 + 14);
+        canvas_draw_line(canvas, x_ptt + 13, y_2 + 14, x_ptt + 22, y_2 + 3);
+    } else {
+        if (model->ptt_pressed && !model->mic_sync_pressed) {
+            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_font(canvas, FontPrimary);
+        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_color(canvas, ColorBlack);
 }
 }
 
 
 static void hid_ptt_trigger_mute(HidPtt* hid_ptt, HidPttModel * model) {
 static void hid_ptt_trigger_mute(HidPtt* hid_ptt, HidPttModel * model) {
@@ -285,10 +309,10 @@ static void hid_ptt_process(HidPtt* hid_ptt, InputEvent* event) {
         hid_ptt->view,
         hid_ptt->view,
         HidPttModel * model,
         HidPttModel * model,
         {
         {
-            if(event->type == InputTypePress) {
+            if(event->type == InputTypePress && !model->ptt_pressed) {
                 if(event->key == InputKeyUp) {
                 if(event->key == InputKeyUp) {
                     model->up_pressed = true;
                     model->up_pressed = true;
-                    if (!model->ptt_pressed){
+                    if (!model->mic_pressed){
                         hid_hal_consumer_key_press(hid_ptt->hid, HID_CONSUMER_VOLUME_INCREMENT);
                         hid_hal_consumer_key_press(hid_ptt->hid, HID_CONSUMER_VOLUME_INCREMENT);
                     } else {
                     } else {
                         if (model->appIndex != HidPttAppIndexFaceTime) {
                         if (model->appIndex != HidPttAppIndexFaceTime) {
@@ -298,28 +322,35 @@ static void hid_ptt_process(HidPtt* hid_ptt, InputEvent* event) {
                     }
                     }
                 } else if(event->key == InputKeyDown) {
                 } else if(event->key == InputKeyDown) {
                     model->down_pressed = true;
                     model->down_pressed = true;
-                    if (!model->ptt_pressed){
+                    if (!model->mic_pressed){
                         hid_hal_consumer_key_press(hid_ptt->hid, HID_CONSUMER_VOLUME_DECREMENT);
                         hid_hal_consumer_key_press(hid_ptt->hid, HID_CONSUMER_VOLUME_DECREMENT);
-                    } else {
+                    } else if (!model->mic_pressed) {
                         hid_ptt_shift_app(model, - 1);
                         hid_ptt_shift_app(model, - 1);
                         notification_message(hid_ptt->hid->notifications, &sequence_single_vibro);
                         notification_message(hid_ptt->hid->notifications, &sequence_single_vibro);
                     }
                     }
                 } else if(event->key == InputKeyLeft) {
                 } else if(event->key == InputKeyLeft) {
                     model->left_pressed = true;
                     model->left_pressed = true;
-                    if (model->ptt_pressed){
+                    if (model->mic_pressed){
                         hid_ptt_shift_app(model, 1);
                         hid_ptt_shift_app(model, 1);
                         notification_message(hid_ptt->hid->notifications, &sequence_single_vibro);
                         notification_message(hid_ptt->hid->notifications, &sequence_single_vibro);
                     }
                     }
                 } else if(event->key == InputKeyRight) {
                 } else if(event->key == InputKeyRight) {
                     model->right_pressed = true;
                     model->right_pressed = true;
-                    if (model->ptt_pressed){
+                    if (model->mic_pressed){
                         hid_ptt_shift_app(model, - 1);
                         hid_ptt_shift_app(model, - 1);
                         notification_message(hid_ptt->hid->notifications, &sequence_single_vibro);
                         notification_message(hid_ptt->hid->notifications, &sequence_single_vibro);
                     }
                     }
                 } else if(event->key == InputKeyOk) {
                 } else if(event->key == InputKeyOk) {
                     model->ptt_pressed = true;
                     model->ptt_pressed = true;
-                    if (model->muted) {
-                        hid_ptt_start_ptt(hid_ptt, model);
+                    if (model->mic_pressed){
+                        // Change local mic status
+                        model->muted = !model->muted;
+                        model->mic_sync_pressed = true;
+                        notification_message(hid_ptt->hid->notifications, &sequence_single_vibro);
+                    } else {
+                        if (model->muted) {
+                            hid_ptt_start_ptt(hid_ptt, model);
+                        }
                     }
                     }
                 } else if(event->key == InputKeyBack) {
                 } else if(event->key == InputKeyBack) {
                     model->mic_pressed = true;
                     model->mic_pressed = true;
@@ -327,12 +358,12 @@ static void hid_ptt_process(HidPtt* hid_ptt, InputEvent* event) {
             } else if(event->type == InputTypeRelease) {
             } else if(event->type == InputTypeRelease) {
                 if(event->key == InputKeyUp) {
                 if(event->key == InputKeyUp) {
                     model->up_pressed = false;
                     model->up_pressed = false;
-                    if (!model->ptt_pressed){
+                    if (!model->mic_pressed && !model->ptt_pressed){
                         hid_hal_consumer_key_release(hid_ptt->hid, HID_CONSUMER_VOLUME_INCREMENT);
                         hid_hal_consumer_key_release(hid_ptt->hid, HID_CONSUMER_VOLUME_INCREMENT);
                     }
                     }
                 } else if(event->key == InputKeyDown) {
                 } else if(event->key == InputKeyDown) {
                     model->down_pressed = false;
                     model->down_pressed = false;
-                    if (!model->ptt_pressed){
+                    if (!model->mic_pressed && !model->ptt_pressed){
                         hid_hal_consumer_key_release(hid_ptt->hid, HID_CONSUMER_VOLUME_DECREMENT);
                         hid_hal_consumer_key_release(hid_ptt->hid, HID_CONSUMER_VOLUME_DECREMENT);
                     }
                     }
                 } else if(event->key == InputKeyLeft) {
                 } else if(event->key == InputKeyLeft) {
@@ -342,44 +373,41 @@ static void hid_ptt_process(HidPtt* hid_ptt, InputEvent* event) {
 
 
                 } else if(event->key == InputKeyOk) {
                 } else if(event->key == InputKeyOk) {
                     model->ptt_pressed = false;
                     model->ptt_pressed = false;
-                    if (model->muted) {
-                        hid_ptt_stop_ptt(hid_ptt, model);
-                    } else {
-                        hid_ptt_trigger_mute(hid_ptt, model);
-                        model->muted = true;
+                    if(!model->mic_pressed && !model->mic_sync_pressed) {
+                        if (model->muted) {
+                            hid_ptt_stop_ptt(hid_ptt, model);
+                        } else {
+                            hid_ptt_trigger_mute(hid_ptt, model);
+                            model->muted = true;
+                        }
                     }
                     }
+                    model->mic_sync_pressed = false;
                 } else if(event->key == InputKeyBack) {
                 } else if(event->key == InputKeyBack) {
                     model->mic_pressed = false;
                     model->mic_pressed = false;
                 }
                 }
-            } else if(event->type == InputTypeShort) {
-                if(event->key == InputKeyBack && !model->ptt_pressed ) { // no changes if PTT is pressed
+            } else if(event->type == InputTypeShort && !model->ptt_pressed) {
+                if(event->key == InputKeyBack ) { // 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) {
-                    if (!model->ptt_pressed){
+                    if (!model->mic_pressed){
                         hid_ptt_trigger_camera(hid_ptt, model);
                         hid_ptt_trigger_camera(hid_ptt, model);
                     }
                     }
                 }
                 }
-            } else if(event->type == InputTypeLong) {
-                if(event->key == InputKeyLeft) {
-                    model->left_pressed = false;
-                    if (!model->ptt_pressed){
-                        hid_hal_keyboard_release_all(hid_ptt->hid);
-                        view_dispatcher_switch_to_view(hid_ptt->hid->view_dispatcher, HidViewSubmenu);
-                        // sequence_double_vibro to notify that we quit PTT
-                        notification_message(hid_ptt->hid->notifications, &sequence_double_vibro);
-                    }
-                } else if(event->key == InputKeyBack && !model->ptt_pressed ) { // no changes if PTT is pressed
-                    // Change local mic status
-                    model->muted = !model->muted;
-                    notification_message(hid_ptt->hid->notifications, &sequence_single_vibro);
+            } else if(event->type == InputTypeLong && event->key == InputKeyLeft) {
+                model->left_pressed = false;
+                if (!model->ptt_pressed){
+                    hid_hal_keyboard_release_all(hid_ptt->hid);
+                    view_dispatcher_switch_to_view(hid_ptt->hid->view_dispatcher, HidViewSubmenu);
+                    // sequence_double_vibro to notify that we quit PTT
+                    notification_message(hid_ptt->hid->notifications, &sequence_double_vibro);
                 }
                 }
             }
             }
             //LED
             //LED
-            if (model->muted && !model->ptt_pressed) {
-                notification_message(hid_ptt->hid->notifications, &sequence_reset_red);
-            } else {
+            if (!model->muted || (model->ptt_pressed && !model->mic_sync_pressed)) {
                 notification_message(hid_ptt->hid->notifications, &sequence_set_red_255);
                 notification_message(hid_ptt->hid->notifications, &sequence_set_red_255);
+            } else {
+                notification_message(hid_ptt->hid->notifications, &sequence_reset_red);
             }
             }
         },
         },
         true);
         true);
@@ -408,6 +436,7 @@ HidPtt* hid_ptt_alloc(Hid* hid) {
             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;
+            model->mic_sync_pressed = false;
         }, true);
         }, true);
     return hid_ptt;
     return hid_ptt;
 }
 }