Skip to content

Commit

Permalink
Merge branch 'main' into edge-set-limits
Browse files Browse the repository at this point in the history
  • Loading branch information
MauAbata authored Feb 26, 2024
2 parents 30ca6a2 + 9fda9bb commit 1888b44
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 10 deletions.
1 change: 1 addition & 0 deletions bin/upload.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ def sh(cmd)
# Always compile on tag.
if opts[:compile] || opts[:tag]
if opts[:pio]
puts `pio run -t clean`
puts `pio run`
else
ino_file = opts[:ino_file]
Expand Down
1 change: 0 additions & 1 deletion include/orgasm_control.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ typedef enum orgasm_output_mode {
OC_MANUAL_CONTROL,
OC_AUTOMAITC_CONTROL,
OC_ORGASM_MODE,
OC_LOCKOUT_POST_MODE,
_OC_MODE_MAX,
_OC_MODE_ERROR = -1
} orgasm_output_mode_t;
Expand Down
26 changes: 19 additions & 7 deletions src/orgasm_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ static const char* orgasm_output_mode_str[] = {
"MANUAL_CONTROL",
"AUTOMAITC_CONTROL",
"ORGASM_MODE",
"LOCKOUT_POST_MODE",
};

static struct {
Expand Down Expand Up @@ -343,8 +342,12 @@ static void orgasm_control_updateEdgingTime() { // Edging+Orgasm timer
}
}
}

eom_hal_set_motor_speed(orgasm_control_getMotorSpeed());
if (orgasm_control_isPermitOrgasmReached() || orgasm_control_isPostOrgasmReached()) {
uint8_t speed = orgasm_control_getMotorSpeed();
eom_hal_set_motor_speed(speed);
accessory_driver_broadcast_speed(speed);
bluetooth_driver_broadcast_speed(speed);
}
}

void orgasm_control_twitchDetect() {
Expand Down Expand Up @@ -398,7 +401,12 @@ void orgasm_control_startRecording() {
}

char* logfile_name = NULL;
asiprintf(&logfile_name, "/log-%s.csv", filename_date);
asiprintf(&logfile_name, "%s/log-%s.csv", eom_hal_get_sd_mount_point(), filename_date);

if (!logfile_name) {
ESP_LOGE(TAG, "Logfile filename buffer issues.");
ui_toast("%s", _("Error opening logfile!"));
}

ESP_LOGI(TAG, "Opening logfile: %s", logfile_name);
logger_state.logfile = fopen(logfile_name, "w+");
Expand All @@ -416,22 +424,26 @@ void orgasm_control_startRecording() {
);

ui_set_icon(UI_ICON_RECORD, RECORD_ICON_RECORDING);
ui_toast(_("Recording started:\n%s"), logfile_name);
char* fntok = basename(logfile_name);
ui_toast(_("Recording started:\n%s"), fntok);
}

free(logfile_name);
}

void orgasm_control_stopRecording() {
if (logger_state.logfile != NULL) {
ui_toast_blocking("%s", _("Stopping..."));
ESP_LOGI(TAG, "Closing logfile.");
fclose(logger_state.logfile);
logger_state.logfile = NULL;
ui_set_icon(UI_ICON_RECORD, -1);
ui_toast("%s", _("Recording stopped."));
}
}

oc_bool_t orgasm_control_isRecording() {
return (oc_bool_t)logger_state.logfile;
return (oc_bool_t) !!logger_state.logfile;
}

void orgasm_control_tick() {
Expand Down Expand Up @@ -601,4 +613,4 @@ oc_bool_t orgasm_control_isMenuLocked() {

void orgasm_control_lockMenuNow(oc_bool_t value) {
post_orgasm_state.menu_is_locked = value;
}
}
8 changes: 7 additions & 1 deletion src/ui/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ static SemaphoreHandle_t _insert_mutex = NULL;
void ui_menu_cb_open_page(
const ui_menu_t* m, const ui_menu_item_t* item, UI_MENU_ARG_TYPE menu_arg
) {
if (item == NULL) return;
const ui_page_t* page = (const ui_page_t*)item->arg;
ui_open_page(page, NULL);
ui_close_all_menu();
}

void ui_menu_cb_open_menu(
Expand Down Expand Up @@ -178,7 +182,9 @@ ui_menu_item_t* ui_menu_add_item(
}

ui_menu_item_t* ui_menu_add_page(const ui_menu_t* m, const ui_page_t* page) {
return NULL;
if (m == NULL || page == NULL) return NULL;

return ui_menu_add_item(m, _(page->title), ui_menu_cb_open_page, (void*)page);
}

ui_menu_item_t* ui_menu_add_menu(const ui_menu_t* m, const ui_menu_t* menu) {
Expand Down
2 changes: 1 addition & 1 deletion src/ui/toast.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ static size_t text_wrap(size_t col, const char* text, text_wrap_cb_t cb, void* c

i = 0;
text_lines++;
} else if (*ptr == ' ') {
} else if (*ptr == ' ' || *ptr == '-') {
space = ptr + 1;
}
}
Expand Down

0 comments on commit 1888b44

Please sign in to comment.