From 1009fc40313411348b53ace98ffff35e31591706 Mon Sep 17 00:00:00 2001 From: Willy-JL <49810075+Willy-JL@users.noreply.github.com> Date: Tue, 20 Jun 2023 18:18:32 +0100 Subject: [PATCH] Orgasmotron fixes (#304) --- .../external/orgasmotron/orgasmotron.c | 88 +++++++++++-------- 1 file changed, 52 insertions(+), 36 deletions(-) diff --git a/applications/external/orgasmotron/orgasmotron.c b/applications/external/orgasmotron/orgasmotron.c index 80c7d9e42..fd66d7b04 100644 --- a/applications/external/orgasmotron/orgasmotron.c +++ b/applications/external/orgasmotron/orgasmotron.c @@ -16,12 +16,9 @@ void vibro_test_draw_callback(Canvas* canvas, void* ctx) { canvas_set_font(canvas, FontPrimary); canvas_draw_str(canvas, 2, 10, "Vibro Modes"); canvas_set_font(canvas, FontSecondary); - canvas_draw_str(canvas, 2, 22, "LEFT: strong / RIGHT: Soft"); - canvas_set_font(canvas, FontSecondary); - canvas_draw_str(canvas, 2, 34, "UP: Pulsed"); - canvas_set_font(canvas, FontSecondary); - canvas_draw_str(canvas, 2, 46, "DOWN Pleasure combo"); - canvas_set_font(canvas, FontSecondary); + canvas_draw_str(canvas, 2, 22, "UP: Pulsed"); + canvas_draw_str(canvas, 2, 34, "LEFT: strong / RIGHT: Soft"); + canvas_draw_str(canvas, 2, 46, "DOWN: Pleasure combo"); canvas_draw_str(canvas, 2, 58, "OK: Pause"); } @@ -59,20 +56,16 @@ int32_t orgasmotron_app(void* p) { NotificationApp* notification = furi_record_open(RECORD_NOTIFICATION); InputEvent event; - //int mode = 0; bool processing = true; - //while(furi_message_queue_get(event_queue, &event, FuriWaitForever) == FuriStatusOk) { + size_t i = 0; while(processing) { - FuriStatus event_status = furi_message_queue_get(event_queue, &event, 100); + FuriStatus event_status = furi_message_queue_get(event_queue, &event, 50); furi_mutex_acquire(plugin_state->mutex, FuriWaitForever); if(event_status == FuriStatusOk) { if(event.key == InputKeyBack && event.type == InputTypeShort) { //Exit Application - notification_message(notification, &sequence_reset_vibro); - notification_message(notification, &sequence_reset_green); plugin_state->mode = 0; processing = false; - //break; } if(event.key == InputKeyOk && (event.type == InputTypePress || event.type == InputTypeRelease)) { @@ -80,57 +73,80 @@ int32_t orgasmotron_app(void* p) { } if(event.key == InputKeyLeft && (event.type == InputTypePress || event.type == InputTypeRelease)) { + notification_message(notification, &sequence_set_green_255); plugin_state->mode = 1; } if(event.key == InputKeyRight && (event.type == InputTypePress || event.type == InputTypeRelease)) { + notification_message(notification, &sequence_set_green_255); plugin_state->mode = 3; } if(event.key == InputKeyUp && (event.type == InputTypePress || event.type == InputTypeRelease)) { + notification_message(notification, &sequence_set_green_255); plugin_state->mode = 2; } if(event.key == InputKeyDown && (event.type == InputTypePress || event.type == InputTypeRelease)) { + notification_message(notification, &sequence_set_green_255); plugin_state->mode = 4; } + i = 0; } if(plugin_state->mode == 0) { //Stop Vibration - notification_message(notification, &sequence_reset_vibro); - notification_message(notification, &sequence_reset_green); + if(i == 0) { + notification_message(notification, &sequence_reset_vibro); + notification_message(notification, &sequence_reset_green); + i++; + } } else if(plugin_state->mode == 1) { //Full power - notification_message(notification, &sequence_set_vibro_on); - notification_message(notification, &sequence_set_green_255); + if(i == 0) { + notification_message(notification, &sequence_set_vibro_on); + i++; + } } else if(plugin_state->mode == 2) { //Pulsed Vibration - notification_message(notification, &sequence_set_vibro_on); - notification_message(notification, &sequence_set_green_255); - delay(100); - notification_message(notification, &sequence_reset_vibro); + i++; + if(i == 1) { + notification_message(notification, &sequence_set_vibro_on); + } + if(i == 3) { + notification_message(notification, &sequence_reset_vibro); + } + if(i == 4) { + i = 0; + } } else if(plugin_state->mode == 3) { //Soft power - notification_message(notification, &sequence_set_vibro_on); - notification_message(notification, &sequence_set_green_255); - delay(50); - notification_message(notification, &sequence_reset_vibro); + i++; + if(i == 1) { + notification_message(notification, &sequence_set_vibro_on); + } + if(i == 2) { + notification_message(notification, &sequence_reset_vibro); + i = 0; + } } else if(plugin_state->mode == 4) { //Special Sequence - for(int i = 0; i < 15; i++) { - notification_message(notification, &sequence_set_vibro_on); - notification_message(notification, &sequence_set_green_255); - delay(50); + i++; + if(i < 23) { + if(i % 2) { + notification_message(notification, &sequence_set_vibro_on); + } else { + notification_message(notification, &sequence_reset_vibro); + } + } else if(i < 40) { + if(i == 24 || i == 33) { + notification_message(notification, &sequence_set_vibro_on); + } else if(i == 32) { + notification_message(notification, &sequence_reset_vibro); + } + } else if(i == 41) { notification_message(notification, &sequence_reset_vibro); - delay(50); - } - for(int i = 0; i < 2; i++) { - notification_message(notification, &sequence_set_vibro_on); - notification_message(notification, &sequence_set_green_255); - delay(400); - notification_message(notification, &sequence_reset_vibro); - delay(50); + i = 0; } } furi_mutex_release(plugin_state->mutex);