From 341a3937c63f03d0bc4da8f2b0d44216767eddee Mon Sep 17 00:00:00 2001 From: RogueMaster Date: Mon, 19 Dec 2022 23:00:43 -0500 Subject: [PATCH 1/3] Updates from xMasterX (mostly) Thanks to @xMasterX --- ReadMe.md | 3 + applications/plugins/airmouse/application.fam | 4 +- .../plugins/airmouse/tracking/main_loop.cc | 8 +- .../plugins/airmouse/tracking/main_loop.h | 4 +- .../plugins/airmouse/views/bt_mouse.c | 174 ++++++++++++++++-- .../plugins/airmouse/views/usb_mouse.c | 9 +- applications/plugins/counter/counter.c | 2 +- applications/plugins/flashlight/flashlight.c | 2 +- .../plugins/music_beeper/application.fam | 8 + .../music_beeper/music_beeper_worker.c | 2 +- .../musictracker/tracker_engine/speaker_hal.c | 4 +- applications/plugins/ocarina/ocarina.c | 10 +- applications/plugins/sam/application.fam | 15 ++ applications/plugins/sam/sam_app.cpp | 38 ++-- applications/plugins/tama_p1/hal.c | 3 +- applications/plugins/tama_p1/tama_p1.c | 2 +- .../plugins/tuning_fork/tuning_fork.c | 2 +- applications/plugins/usb_midi/usb_midi.c | 4 +- applications/plugins/yatzee/README.md | 2 +- 19 files changed, 244 insertions(+), 52 deletions(-) diff --git a/ReadMe.md b/ReadMe.md index edbad7d8c..847e61dc3 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -37,6 +37,9 @@ Thank you to all the supporters! - [New Animation Pack Release on Patreon: RM Select + 18PLUS](https://www.patreon.com/RogueMaster) - Fix path for Music Beeper - Fix some sound crash issues in FAPs. +- Optimized some FAPs and fixed Air Mouse with thanks to [xMasterX](https://github.com/xMasterX/unleashed-extra-pack) +- Added: [SAM WTF (By Unknown)][Original?](https://github.com/ctoth/SAM) +- Fixed: [Music Beeper (By DrZlo13)](https://github.com/flipperdevices/flipperzero-firmware/pull/1189) (With Changes By qqMajiKpp/Haseo) ## Install from Release FLASH STOCK FIRST BEFORE UPDATING TO CUSTOM FIRMWARE! diff --git a/applications/plugins/airmouse/application.fam b/applications/plugins/airmouse/application.fam index 97003ef89..c646ee7e1 100644 --- a/applications/plugins/airmouse/application.fam +++ b/applications/plugins/airmouse/application.fam @@ -1,9 +1,9 @@ App( - appid="Air_Mouse", + appid="BMI160_Air_Mouse", name="[BMI160] Air Mouse", apptype=FlipperAppType.EXTERNAL, entry_point="air_mouse_app", stack_size=10 * 1024, fap_icon="mouse_10px.png", - fap_category="NeedsTesting", + fap_category="GPIO", ) diff --git a/applications/plugins/airmouse/tracking/main_loop.cc b/applications/plugins/airmouse/tracking/main_loop.cc index 492157a4d..2caffb717 100644 --- a/applications/plugins/airmouse/tracking/main_loop.cc +++ b/applications/plugins/airmouse/tracking/main_loop.cc @@ -43,7 +43,7 @@ static inline float highpass(float oldVal, float newVal) return newVal + alpha * delta; } -void sendCurrentState(MouseMoveCallback mouse_move) +void sendCurrentState(MouseMoveCallback mouse_move, void *context) { float dX = g_dYaw * CURSOR_SPEED; float dY = g_dPitch * CURSOR_SPEED; @@ -69,7 +69,7 @@ void sendCurrentState(MouseMoveCallback mouse_move) const int8_t x = (int8_t)std::floor(dX + 0.5); const int8_t y = (int8_t)std::floor(dY + 0.5); - mouse_move(x, y); + mouse_move(x, y, context); // Only subtract the part of the error that was already sent. if (x != 0) { @@ -160,7 +160,7 @@ void tracking_begin() { tracker.Resume(); } -void tracking_step(MouseMoveCallback mouse_move) { +void tracking_step(MouseMoveCallback mouse_move, void *context) { double vec[6]; int ret = imu_read(vec); if (ret != 0) { @@ -177,7 +177,7 @@ void tracking_step(MouseMoveCallback mouse_move) { .data = cardboard::Vector3(vec[3], vec[4], vec[5]) }; cardboard::Vector4 pose = tracker.OnGyroscopeData(gdata); onOrientation(pose); - sendCurrentState(mouse_move); + sendCurrentState(mouse_move, context); } } } diff --git a/applications/plugins/airmouse/tracking/main_loop.h b/applications/plugins/airmouse/tracking/main_loop.h index ce0d96568..cd592161f 100644 --- a/applications/plugins/airmouse/tracking/main_loop.h +++ b/applications/plugins/airmouse/tracking/main_loop.h @@ -6,14 +6,14 @@ extern "C" { #endif -typedef bool (*MouseMoveCallback)(int8_t x, int8_t y); +typedef bool (*MouseMoveCallback)(int8_t x, int8_t y, void* context); void calibration_begin(); bool calibration_step(); void calibration_end(); void tracking_begin(); -void tracking_step(MouseMoveCallback mouse_move); +void tracking_step(MouseMoveCallback mouse_move, void* context); void tracking_end(); #ifdef __cplusplus diff --git a/applications/plugins/airmouse/views/bt_mouse.c b/applications/plugins/airmouse/views/bt_mouse.c index 1a6ea3020..e6e0ae45a 100644 --- a/applications/plugins/airmouse/views/bt_mouse.c +++ b/applications/plugins/airmouse/views/bt_mouse.c @@ -10,16 +10,49 @@ #include #include +typedef struct ButtonEvent { + int8_t button; + bool state; +} ButtonEvent; + +#define BTN_EVT_QUEUE_SIZE 32 + struct BtMouse { View* view; ViewDispatcher* view_dispatcher; Bt* bt; NotificationApp* notifications; + FuriMutex* mutex; + FuriThread* thread; + bool connected; + + // Current mouse state + uint8_t btn; + int dx; + int dy; + int wheel; + + // Circular buffer; + // (qhead == qtail) means either empty or overflow. + // We'll ignore overflow and treat it as empty. + int qhead; + int qtail; + ButtonEvent queue[BTN_EVT_QUEUE_SIZE]; }; +#define BT_MOUSE_FLAG_INPUT_EVENT (1UL << 0) +#define BT_MOUSE_FLAG_KILL_THREAD (1UL << 1) +#define BT_MOUSE_FLAG_ALL (BT_MOUSE_FLAG_INPUT_EVENT | BT_MOUSE_FLAG_KILL_THREAD) + #define MOUSE_MOVE_SHORT 5 #define MOUSE_MOVE_LONG 20 +static void bt_mouse_notify_event(BtMouse* bt_mouse) { + FuriThreadId thread_id = furi_thread_get_id(bt_mouse->thread); + furi_assert(thread_id); + furi_thread_flags_set(thread_id, BT_MOUSE_FLAG_INPUT_EVENT); +} + static void bt_mouse_draw_callback(Canvas* canvas, void* context) { UNUSED(context); canvas_clear(canvas); @@ -29,6 +62,20 @@ static void bt_mouse_draw_callback(Canvas* canvas, void* context) { canvas_draw_str(canvas, 0, 63, "Hold [back] to exit"); } +static void bt_mouse_button_state(BtMouse* bt_mouse, int8_t button, bool state) { + ButtonEvent event; + event.button = button; + event.state = state; + + if(bt_mouse->connected) { + furi_mutex_acquire(bt_mouse->mutex, FuriWaitForever); + bt_mouse->queue[bt_mouse->qtail++] = event; + bt_mouse->qtail %= BTN_EVT_QUEUE_SIZE; + furi_mutex_release(bt_mouse->mutex); + bt_mouse_notify_event(bt_mouse); + } +} + static void bt_mouse_process(BtMouse* bt_mouse, InputEvent* event) { with_view_model( bt_mouse->view, @@ -37,21 +84,21 @@ static void bt_mouse_process(BtMouse* bt_mouse, InputEvent* event) { UNUSED(model); if(event->key == InputKeyUp) { if(event->type == InputTypePress) { - furi_hal_bt_hid_mouse_press(HID_MOUSE_BTN_LEFT); + bt_mouse_button_state(bt_mouse, HID_MOUSE_BTN_LEFT, true); } else if(event->type == InputTypeRelease) { - furi_hal_bt_hid_mouse_release(HID_MOUSE_BTN_LEFT); + bt_mouse_button_state(bt_mouse, HID_MOUSE_BTN_LEFT, false); } } else if(event->key == InputKeyDown) { if(event->type == InputTypePress) { - furi_hal_bt_hid_mouse_press(HID_MOUSE_BTN_RIGHT); + bt_mouse_button_state(bt_mouse, HID_MOUSE_BTN_RIGHT, true); } else if(event->type == InputTypeRelease) { - furi_hal_bt_hid_mouse_release(HID_MOUSE_BTN_RIGHT); + bt_mouse_button_state(bt_mouse, HID_MOUSE_BTN_RIGHT, false); } } else if(event->key == InputKeyOk) { if(event->type == InputTypePress) { - furi_hal_bt_hid_mouse_press(HID_MOUSE_BTN_WHEEL); + bt_mouse_button_state(bt_mouse, HID_MOUSE_BTN_WHEEL, true); } else if(event->type == InputTypeRelease) { - furi_hal_bt_hid_mouse_release(HID_MOUSE_BTN_WHEEL); + bt_mouse_button_state(bt_mouse, HID_MOUSE_BTN_WHEEL, false); } } }, @@ -77,10 +124,13 @@ void bt_mouse_connection_status_changed_callback(BtStatus status, void* context) furi_assert(context); BtMouse* bt_mouse = context; - bool connected = (status == BtStatusConnected); - if(connected) { + bt_mouse->connected = (status == BtStatusConnected); + if(bt_mouse->connected) { notification_internal_message(bt_mouse->notifications, &sequence_set_blue_255); + tracking_begin(); + view_dispatcher_send_custom_event(bt_mouse->view_dispatcher, 0); } else { + tracking_end(); notification_internal_message(bt_mouse->notifications, &sequence_reset_blue); } @@ -88,6 +138,21 @@ void bt_mouse_connection_status_changed_callback(BtStatus status, void* context) // bt_mouse->view, void * model, { model->connected = connected; }, true); } +bool bt_mouse_move(int8_t dx, int8_t dy, void* context) { + furi_assert(context); + BtMouse* bt_mouse = context; + + if(bt_mouse->connected) { + furi_mutex_acquire(bt_mouse->mutex, FuriWaitForever); + bt_mouse->dx += dx; + bt_mouse->dy += dy; + furi_mutex_release(bt_mouse->mutex); + bt_mouse_notify_event(bt_mouse); + } + + return true; +} + void bt_mouse_enter_callback(void* context) { furi_assert(context); BtMouse* bt_mouse = context; @@ -98,10 +163,6 @@ void bt_mouse_enter_callback(void* context) { bt_mouse->bt, bt_mouse_connection_status_changed_callback, bt_mouse); furi_assert(bt_set_profile(bt_mouse->bt, BtProfileHidKeyboard)); furi_hal_bt_start_advertising(); - - tracking_begin(); - - view_dispatcher_send_custom_event(bt_mouse->view_dispatcher, 0); } bool bt_mouse_custom_callback(uint32_t event, void* context) { @@ -109,7 +170,8 @@ bool bt_mouse_custom_callback(uint32_t event, void* context) { furi_assert(context); BtMouse* bt_mouse = context; - tracking_step(furi_hal_bt_hid_mouse_move); + tracking_step(bt_mouse_move, context); + furi_delay_ms(3); // Magic! Removing this will break the buttons view_dispatcher_send_custom_event(bt_mouse->view_dispatcher, 0); return true; @@ -120,7 +182,6 @@ void bt_mouse_exit_callback(void* context) { BtMouse* bt_mouse = context; tracking_end(); - notification_internal_message(bt_mouse->notifications, &sequence_reset_blue); furi_hal_bt_stop_advertising(); @@ -132,8 +193,91 @@ void bt_mouse_exit_callback(void* context) { bt_mouse->bt = NULL; } +static int8_t clamp(int t) { + if(t < -128) { + return -128; + } else if(t > 127) { + return 127; + } + return t; +} + +static int32_t bt_mouse_thread_callback(void* context) { + furi_assert(context); + BtMouse* bt_mouse = (BtMouse*)context; + + while(1) { + uint32_t flags = + furi_thread_flags_wait(BT_MOUSE_FLAG_ALL, FuriFlagWaitAny, FuriWaitForever); + if(flags & BT_MOUSE_FLAG_KILL_THREAD) { + break; + } + if(flags & BT_MOUSE_FLAG_INPUT_EVENT) { + furi_mutex_acquire(bt_mouse->mutex, FuriWaitForever); + + ButtonEvent event; + bool send_buttons = false; + if(bt_mouse->qhead != bt_mouse->qtail) { + event = bt_mouse->queue[bt_mouse->qhead++]; + bt_mouse->qhead %= BTN_EVT_QUEUE_SIZE; + send_buttons = true; + } + + int8_t dx = clamp(bt_mouse->dx); + bt_mouse->dx -= dx; + int8_t dy = clamp(bt_mouse->dy); + bt_mouse->dy -= dy; + int8_t wheel = clamp(bt_mouse->wheel); + bt_mouse->wheel -= wheel; + + furi_mutex_release(bt_mouse->mutex); + + if(bt_mouse->connected && send_buttons) { + if(event.state) { + furi_hal_bt_hid_mouse_press(event.button); + } else { + furi_hal_bt_hid_mouse_release(event.button); + } + } + + if(bt_mouse->connected && (dx != 0 || dy != 0)) { + furi_hal_bt_hid_mouse_move(dx, dy); + } + + if(bt_mouse->connected && wheel != 0) { + furi_hal_bt_hid_mouse_scroll(wheel); + } + } + } + + return 0; +} + +void bt_mouse_thread_start(BtMouse* bt_mouse) { + furi_assert(bt_mouse); + bt_mouse->mutex = furi_mutex_alloc(FuriMutexTypeNormal); + bt_mouse->thread = furi_thread_alloc(); + furi_thread_set_name(bt_mouse->thread, "BtSender"); + furi_thread_set_stack_size(bt_mouse->thread, 1024); + furi_thread_set_context(bt_mouse->thread, bt_mouse); + furi_thread_set_callback(bt_mouse->thread, bt_mouse_thread_callback); + furi_thread_start(bt_mouse->thread); +} + +void bt_mouse_thread_stop(BtMouse* bt_mouse) { + furi_assert(bt_mouse); + FuriThreadId thread_id = furi_thread_get_id(bt_mouse->thread); + furi_assert(thread_id); + furi_thread_flags_set(thread_id, BT_MOUSE_FLAG_KILL_THREAD); + furi_thread_join(bt_mouse->thread); + furi_thread_free(bt_mouse->thread); + furi_mutex_free(bt_mouse->mutex); +} + BtMouse* bt_mouse_alloc(ViewDispatcher* view_dispatcher) { BtMouse* bt_mouse = malloc(sizeof(BtMouse)); + memset(bt_mouse, 0, sizeof(BtMouse)); + bt_mouse->view = view_alloc(); bt_mouse->view_dispatcher = view_dispatcher; view_set_context(bt_mouse->view, bt_mouse); @@ -142,11 +286,13 @@ BtMouse* bt_mouse_alloc(ViewDispatcher* view_dispatcher) { view_set_enter_callback(bt_mouse->view, bt_mouse_enter_callback); view_set_custom_callback(bt_mouse->view, bt_mouse_custom_callback); view_set_exit_callback(bt_mouse->view, bt_mouse_exit_callback); + bt_mouse_thread_start(bt_mouse); return bt_mouse; } void bt_mouse_free(BtMouse* bt_mouse) { furi_assert(bt_mouse); + bt_mouse_thread_stop(bt_mouse); view_free(bt_mouse->view); free(bt_mouse); } diff --git a/applications/plugins/airmouse/views/usb_mouse.c b/applications/plugins/airmouse/views/usb_mouse.c index 2d5f1b0a9..5d9ab4352 100644 --- a/applications/plugins/airmouse/views/usb_mouse.c +++ b/applications/plugins/airmouse/views/usb_mouse.c @@ -78,13 +78,18 @@ void usb_mouse_enter_callback(void* context) { view_dispatcher_send_custom_event(usb_mouse->view_dispatcher, 0); } +bool usb_mouse_move(int8_t dx, int8_t dy, void* context) { + UNUSED(context); + return furi_hal_hid_mouse_move(dx, dy); +} + bool usb_mouse_custom_callback(uint32_t event, void* context) { UNUSED(event); furi_assert(context); UsbMouse* usb_mouse = context; - tracking_step(furi_hal_hid_mouse_move); - furi_delay_ms(1); // Magic! Removing this will break the buttons + tracking_step(usb_mouse_move, context); + furi_delay_ms(3); // Magic! Removing this will break the buttons view_dispatcher_send_custom_event(usb_mouse->view_dispatcher, 0); return true; diff --git a/applications/plugins/counter/counter.c b/applications/plugins/counter/counter.c index 370f9e65a..886ad3398 100644 --- a/applications/plugins/counter/counter.c +++ b/applications/plugins/counter/counter.c @@ -90,7 +90,7 @@ int32_t counterapp(void) { furi_mutex_release(c->mutex); state_free(c); return 0; - } else if(input.key == InputKeyUp && c->count < MAX_COUNT) { + } else if((input.key == InputKeyUp || input.key == InputKeyOk) && c->count < MAX_COUNT) { c->pressed = true; c->boxtimer = BOXTIME; c->count++; diff --git a/applications/plugins/flashlight/flashlight.c b/applications/plugins/flashlight/flashlight.c index 9c5f600f7..534d48fdb 100644 --- a/applications/plugins/flashlight/flashlight.c +++ b/applications/plugins/flashlight/flashlight.c @@ -127,4 +127,4 @@ int32_t flashlight_app() { delete_mutex(&state_mutex); return 0; -} \ No newline at end of file +} diff --git a/applications/plugins/music_beeper/application.fam b/applications/plugins/music_beeper/application.fam index 3bde6aa52..2a83867bf 100644 --- a/applications/plugins/music_beeper/application.fam +++ b/applications/plugins/music_beeper/application.fam @@ -15,3 +15,11 @@ App( fap_category="Music", fap_icon_assets="icons", ) + +App( + appid="music_beeper_start", + apptype=FlipperAppType.STARTUP, + entry_point="music_beeper_on_system_start", + requires=["music_beeper"], + order=30, +) diff --git a/applications/plugins/music_beeper/music_beeper_worker.c b/applications/plugins/music_beeper/music_beeper_worker.c index d31135e1d..4523b806e 100644 --- a/applications/plugins/music_beeper/music_beeper_worker.c +++ b/applications/plugins/music_beeper/music_beeper_worker.c @@ -79,7 +79,7 @@ static int32_t music_beeper_worker_thread_callback(void* context) { furi_hal_speaker_stop(); furi_hal_speaker_start(frequency, volume); while(instance->should_work && furi_get_tick() < next_tick) { - volume *= 0.9945679; + volume *= 1; furi_hal_speaker_set_volume(volume); furi_delay_ms(2); } diff --git a/applications/plugins/musictracker/tracker_engine/speaker_hal.c b/applications/plugins/musictracker/tracker_engine/speaker_hal.c index aa79e5395..14a9c4f85 100644 --- a/applications/plugins/musictracker/tracker_engine/speaker_hal.c +++ b/applications/plugins/musictracker/tracker_engine/speaker_hal.c @@ -40,10 +40,10 @@ void tracker_speaker_stop() { } void tracker_speaker_init() { - if(furi_hal_speaker_acquire(30)) { + if(furi_hal_speaker_is_mine() || furi_hal_speaker_acquire(30)) { furi_hal_speaker_start(200.0f, 0.01f); + tracker_speaker_stop(); } - tracker_speaker_stop(); } void tracker_speaker_deinit() { diff --git a/applications/plugins/ocarina/ocarina.c b/applications/plugins/ocarina/ocarina.c index 2ca281c8e..80dc1fddc 100644 --- a/applications/plugins/ocarina/ocarina.c +++ b/applications/plugins/ocarina/ocarina.c @@ -88,27 +88,27 @@ int32_t ocarina_app(void* p) { if(event.type == InputTypePress) { switch(event.key) { case InputKeyUp: - if(furi_hal_speaker_acquire(30)) { + if(furi_hal_speaker_is_mine() || furi_hal_speaker_acquire(30)) { furi_hal_speaker_start(NOTE_UP, volume); } break; case InputKeyDown: - if(furi_hal_speaker_acquire(30)) { + if(furi_hal_speaker_is_mine() || furi_hal_speaker_acquire(30)) { furi_hal_speaker_start(NOTE_DOWN, volume); } break; case InputKeyLeft: - if(furi_hal_speaker_acquire(30)) { + if(furi_hal_speaker_is_mine() || furi_hal_speaker_acquire(30)) { furi_hal_speaker_start(NOTE_LEFT, volume); } break; case InputKeyRight: - if(furi_hal_speaker_acquire(30)) { + if(furi_hal_speaker_is_mine() || furi_hal_speaker_acquire(30)) { furi_hal_speaker_start(NOTE_RIGHT, volume); } break; case InputKeyOk: - if(furi_hal_speaker_acquire(30)) { + if(furi_hal_speaker_is_mine() || furi_hal_speaker_acquire(30)) { furi_hal_speaker_start(NOTE_OK, volume); } break; diff --git a/applications/plugins/sam/application.fam b/applications/plugins/sam/application.fam index 0fd70ee42..100840482 100644 --- a/applications/plugins/sam/application.fam +++ b/applications/plugins/sam/application.fam @@ -43,3 +43,18 @@ App( fap_category="Music", fap_icon_assets="icons", ) +App( + appid="SAM_WTF", + name="SAM WTF", + apptype=FlipperAppType.EXTERNAL, + entry_point="sam_app_wtf", + requires=[ + "gui", + "dialogs", + ], + stack_size=4 * 1024, + order=20, + fap_icon="icons/music_10px.png", + fap_category="Music", + fap_icon_assets="icons", +) diff --git a/applications/plugins/sam/sam_app.cpp b/applications/plugins/sam/sam_app.cpp index 4b218d1f7..c46c6d3a2 100644 --- a/applications/plugins/sam/sam_app.cpp +++ b/applications/plugins/sam/sam_app.cpp @@ -1,32 +1,46 @@ #include +#include #include "stm32_sam.h" // WOULD BE COOL IF SOMEONE MADE A TEXT ENTRY SCREEN TO HAVE IT READ WHAT IS ENTERED TO TEXT STM32SAM voice; extern "C" int32_t sam_app(void* p) { UNUSED(p); - - voice.begin(); - voice.say( - "All your base are belong to us. You have no chance to survive make your time. ha. ha. ha. GOOD BYE. "); - + if(furi_hal_speaker_is_mine() || furi_hal_speaker_acquire(30)) { + voice.begin(); + voice.say( + "All your base are belong to us. You have no chance to survive make your time. ha. ha. ha. GOOD BYE. "); + furi_hal_speaker_release(); + } return 0; } extern "C" int32_t sam_app_yes(void* p) { UNUSED(p); - - voice.begin(); - voice.say("Yes"); - + if(furi_hal_speaker_is_mine() || furi_hal_speaker_acquire(30)) { + voice.begin(); + voice.say("Yes"); + furi_hal_speaker_release(); + } return 0; } extern "C" int32_t sam_app_no(void* p) { UNUSED(p); + if(furi_hal_speaker_is_mine() || furi_hal_speaker_acquire(30)) { + voice.begin(); + voice.say("No"); + furi_hal_speaker_release(); + } + return 0; +} - voice.begin(); - voice.say("No"); - +extern "C" int32_t sam_app_wtf(void* p) { + UNUSED(p); + if(furi_hal_speaker_is_mine() || furi_hal_speaker_acquire(30)) { + voice.begin(); + voice.say("What The Fuck"); + furi_hal_speaker_release(); + } return 0; } \ No newline at end of file diff --git a/applications/plugins/tama_p1/hal.c b/applications/plugins/tama_p1/hal.c index 8e601f8b0..b4638a84a 100644 --- a/applications/plugins/tama_p1/hal.c +++ b/applications/plugins/tama_p1/hal.c @@ -103,7 +103,7 @@ static void tama_p1_hal_set_lcd_icon(u8_t icon, bool_t val) { static void tama_p1_hal_play_frequency(bool_t en) { if(en) { - if(furi_hal_speaker_acquire(30)) { + if(furi_hal_speaker_is_mine() || furi_hal_speaker_acquire(30)) { furi_hal_speaker_start(g_ctx->frequency, 0.5f); } } else { @@ -112,6 +112,7 @@ static void tama_p1_hal_play_frequency(bool_t en) { furi_hal_speaker_release(); } } + g_ctx->buzzer_on = en; } diff --git a/applications/plugins/tama_p1/tama_p1.c b/applications/plugins/tama_p1/tama_p1.c index f2da6b394..6e7972000 100644 --- a/applications/plugins/tama_p1/tama_p1.c +++ b/applications/plugins/tama_p1/tama_p1.c @@ -246,7 +246,7 @@ int32_t tama_p1_app(void* p) { } else if(event.type == EventTypeInput) { FURI_LOG_D( TAG, - "EventTypeInput: %d %d %d", + "EventTypeInput: %ld %d %d", event.input.sequence, event.input.key, event.input.type); diff --git a/applications/plugins/tuning_fork/tuning_fork.c b/applications/plugins/tuning_fork/tuning_fork.c index 78fe269a1..69a76029f 100644 --- a/applications/plugins/tuning_fork/tuning_fork.c +++ b/applications/plugins/tuning_fork/tuning_fork.c @@ -114,7 +114,7 @@ static void decrease_volume(TuningForkState* tuning_fork_state) { } static void play(TuningForkState* tuning_fork_state) { - if(furi_hal_speaker_acquire(30)) { + if(furi_hal_speaker_is_mine() || furi_hal_speaker_acquire(30)) { furi_hal_speaker_start( current_tuning_note_freq(tuning_fork_state), tuning_fork_state->volume); } diff --git a/applications/plugins/usb_midi/usb_midi.c b/applications/plugins/usb_midi/usb_midi.c index b226bb58a..d82fb74d7 100644 --- a/applications/plugins/usb_midi/usb_midi.c +++ b/applications/plugins/usb_midi/usb_midi.c @@ -57,14 +57,14 @@ int32_t usb_midi_app(void* p) { if(event->type == NoteOn) { NoteOnEvent note_on = AsNoteOn(event); current_note = note_on.note; - if(furi_hal_speaker_acquire(30)) { + if(furi_hal_speaker_is_mine() || furi_hal_speaker_acquire(30)) { furi_hal_speaker_start( note_to_frequency(note_on.note), note_on.velocity / 127.0f); } } else if(event->type == NoteOff) { NoteOffEvent note_off = AsNoteOff(event); - if(furi_hal_speaker_is_mine() && note_off.note == current_note) { + if(note_off.note == current_note && furi_hal_speaker_is_mine()) { furi_hal_speaker_stop(); furi_hal_speaker_release(); } diff --git a/applications/plugins/yatzee/README.md b/applications/plugins/yatzee/README.md index 7483879e2..25351ef49 100644 --- a/applications/plugins/yatzee/README.md +++ b/applications/plugins/yatzee/README.md @@ -1,7 +1,7 @@ # flipperzero-yatzee Yahtzee game for flipperzero -Code is bad, I should feel bad, but it works and now I can play Yahtzee on my flipper while I shit at work. +Its not beautiful, but it works and now I can play Yahtzee on my flipper while I shit at work. Installation: From 635dae23f1e9b326d933abaae1a8b42eda6f938e Mon Sep 17 00:00:00 2001 From: RogueMaster Date: Mon, 19 Dec 2022 23:05:22 -0500 Subject: [PATCH 2/3] Update application.fam --- applications/plugins/usb_midi/application.fam | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/applications/plugins/usb_midi/application.fam b/applications/plugins/usb_midi/application.fam index 9eb971134..d44153fd7 100644 --- a/applications/plugins/usb_midi/application.fam +++ b/applications/plugins/usb_midi/application.fam @@ -9,6 +9,6 @@ App( stack_size=4 * 1024, order=20, fap_icon="usb_midi.png", - fap_category="NeedsTesting", + fap_category="Music", # fap_icon_assets="icons", ) From 5a642f377af08d0d726f47bf06071cc2ce255950 Mon Sep 17 00:00:00 2001 From: RogueMaster Date: Mon, 19 Dec 2022 23:09:03 -0500 Subject: [PATCH 3/3] Update ReadMe.md --- ReadMe.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ReadMe.md b/ReadMe.md index 847e61dc3..570e7668f 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -37,9 +37,11 @@ Thank you to all the supporters! - [New Animation Pack Release on Patreon: RM Select + 18PLUS](https://www.patreon.com/RogueMaster) - Fix path for Music Beeper - Fix some sound crash issues in FAPs. -- Optimized some FAPs and fixed Air Mouse with thanks to [xMasterX](https://github.com/xMasterX/unleashed-extra-pack) +- Optimized some FAPs thanks to [xMasterX](https://github.com/xMasterX/unleashed-extra-pack) - Added: [SAM WTF (By Unknown)][Original?](https://github.com/ctoth/SAM) -- Fixed: [Music Beeper (By DrZlo13)](https://github.com/flipperdevices/flipperzero-firmware/pull/1189) (With Changes By qqMajiKpp/Haseo) +- Fixed: [Music Beeper (By DrZlo13)](https://github.com/flipperdevices/flipperzero-firmware/pull/1189) (With Changes By qqMajiKpp/Haseo) with thanks to [xMasterX](https://github.com/xMasterX/unleashed-extra-pack) +- Fixed: [Air Mouse (By ginkage)](https://github.com/ginkage/FlippAirMouse/) with thanks to [xMasterX](https://github.com/xMasterX/unleashed-extra-pack) +- Fixed: [USB Midi (By DrZlo13)](https://github.com/DrZlo13/flipper-zero-usb-midi) with thanks to [xMasterX](https://github.com/xMasterX/unleashed-extra-pack) ## Install from Release FLASH STOCK FIRST BEFORE UPDATING TO CUSTOM FIRMWARE! @@ -260,6 +262,7 @@ $ ./fbt resources icons dolphin_ext - [UART Echo (By DrZlo13)-OFW](https://github.com/flipperdevices/flipperzero-firmware/pull/831) - [USB HID Autofire (By pbek)](https://github.com/pbek/usb_hid_autofire) - [USB Keyboard (By huuck)](https://github.com/huuck/FlipperZeroUSBKeyboard) +- [USB Midi (By DrZlo13)](https://github.com/DrZlo13/flipper-zero-usb-midi) with thanks to [xMasterX](https://github.com/xMasterX/unleashed-extra-pack) - [WAV Player (By DrZlo13)](https://github.com/flipperdevices/flipperzero-firmware/tree/zlo/wav-player) Updated by Atmanos & RogueMaster To Work - [WiFi (Deauther) V2 (By Timmotools)](https://github.com/Timmotools/flipperzero_esp8266_deautherv2) `Req: ESP8266` - [WiFi (Marauder) (By 0xchocolate)](https://github.com/0xchocolate/flipperzero-firmware-with-wifi-marauder-companion) `Req: ESP32 WITH MARAUDER FLASHED`