Orgasmotron fixes (#304)

This commit is contained in:
Willy-JL
2023-06-20 18:18:32 +01:00
parent eb20b89f25
commit 1009fc4031

View File

@@ -16,12 +16,9 @@ void vibro_test_draw_callback(Canvas* canvas, void* ctx) {
canvas_set_font(canvas, FontPrimary); canvas_set_font(canvas, FontPrimary);
canvas_draw_str(canvas, 2, 10, "Vibro Modes"); canvas_draw_str(canvas, 2, 10, "Vibro Modes");
canvas_set_font(canvas, FontSecondary); canvas_set_font(canvas, FontSecondary);
canvas_draw_str(canvas, 2, 22, "LEFT: strong / RIGHT: Soft"); canvas_draw_str(canvas, 2, 22, "UP: Pulsed");
canvas_set_font(canvas, FontSecondary); canvas_draw_str(canvas, 2, 34, "LEFT: strong / RIGHT: Soft");
canvas_draw_str(canvas, 2, 34, "UP: Pulsed"); canvas_draw_str(canvas, 2, 46, "DOWN: Pleasure combo");
canvas_set_font(canvas, FontSecondary);
canvas_draw_str(canvas, 2, 46, "DOWN Pleasure combo");
canvas_set_font(canvas, FontSecondary);
canvas_draw_str(canvas, 2, 58, "OK: Pause"); 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); NotificationApp* notification = furi_record_open(RECORD_NOTIFICATION);
InputEvent event; InputEvent event;
//int mode = 0;
bool processing = true; bool processing = true;
//while(furi_message_queue_get(event_queue, &event, FuriWaitForever) == FuriStatusOk) { size_t i = 0;
while(processing) { 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); furi_mutex_acquire(plugin_state->mutex, FuriWaitForever);
if(event_status == FuriStatusOk) { if(event_status == FuriStatusOk) {
if(event.key == InputKeyBack && event.type == InputTypeShort) { if(event.key == InputKeyBack && event.type == InputTypeShort) {
//Exit Application //Exit Application
notification_message(notification, &sequence_reset_vibro);
notification_message(notification, &sequence_reset_green);
plugin_state->mode = 0; plugin_state->mode = 0;
processing = false; processing = false;
//break;
} }
if(event.key == InputKeyOk && if(event.key == InputKeyOk &&
(event.type == InputTypePress || event.type == InputTypeRelease)) { (event.type == InputTypePress || event.type == InputTypeRelease)) {
@@ -80,57 +73,80 @@ int32_t orgasmotron_app(void* p) {
} }
if(event.key == InputKeyLeft && if(event.key == InputKeyLeft &&
(event.type == InputTypePress || event.type == InputTypeRelease)) { (event.type == InputTypePress || event.type == InputTypeRelease)) {
notification_message(notification, &sequence_set_green_255);
plugin_state->mode = 1; plugin_state->mode = 1;
} }
if(event.key == InputKeyRight && if(event.key == InputKeyRight &&
(event.type == InputTypePress || event.type == InputTypeRelease)) { (event.type == InputTypePress || event.type == InputTypeRelease)) {
notification_message(notification, &sequence_set_green_255);
plugin_state->mode = 3; plugin_state->mode = 3;
} }
if(event.key == InputKeyUp && if(event.key == InputKeyUp &&
(event.type == InputTypePress || event.type == InputTypeRelease)) { (event.type == InputTypePress || event.type == InputTypeRelease)) {
notification_message(notification, &sequence_set_green_255);
plugin_state->mode = 2; plugin_state->mode = 2;
} }
if(event.key == InputKeyDown && if(event.key == InputKeyDown &&
(event.type == InputTypePress || event.type == InputTypeRelease)) { (event.type == InputTypePress || event.type == InputTypeRelease)) {
notification_message(notification, &sequence_set_green_255);
plugin_state->mode = 4; plugin_state->mode = 4;
} }
i = 0;
} }
if(plugin_state->mode == 0) { if(plugin_state->mode == 0) {
//Stop Vibration //Stop Vibration
notification_message(notification, &sequence_reset_vibro); if(i == 0) {
notification_message(notification, &sequence_reset_green); notification_message(notification, &sequence_reset_vibro);
notification_message(notification, &sequence_reset_green);
i++;
}
} else if(plugin_state->mode == 1) { } else if(plugin_state->mode == 1) {
//Full power //Full power
notification_message(notification, &sequence_set_vibro_on); if(i == 0) {
notification_message(notification, &sequence_set_green_255); notification_message(notification, &sequence_set_vibro_on);
i++;
}
} else if(plugin_state->mode == 2) { } else if(plugin_state->mode == 2) {
//Pulsed Vibration //Pulsed Vibration
notification_message(notification, &sequence_set_vibro_on); i++;
notification_message(notification, &sequence_set_green_255); if(i == 1) {
delay(100); notification_message(notification, &sequence_set_vibro_on);
notification_message(notification, &sequence_reset_vibro); }
if(i == 3) {
notification_message(notification, &sequence_reset_vibro);
}
if(i == 4) {
i = 0;
}
} else if(plugin_state->mode == 3) { } else if(plugin_state->mode == 3) {
//Soft power //Soft power
notification_message(notification, &sequence_set_vibro_on); i++;
notification_message(notification, &sequence_set_green_255); if(i == 1) {
delay(50); notification_message(notification, &sequence_set_vibro_on);
notification_message(notification, &sequence_reset_vibro); }
if(i == 2) {
notification_message(notification, &sequence_reset_vibro);
i = 0;
}
} else if(plugin_state->mode == 4) { } else if(plugin_state->mode == 4) {
//Special Sequence //Special Sequence
for(int i = 0; i < 15; i++) { i++;
notification_message(notification, &sequence_set_vibro_on); if(i < 23) {
notification_message(notification, &sequence_set_green_255); if(i % 2) {
delay(50); 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); notification_message(notification, &sequence_reset_vibro);
delay(50); i = 0;
}
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);
} }
} }
furi_mutex_release(plugin_state->mutex); furi_mutex_release(plugin_state->mutex);