Skip to content
4 changes: 2 additions & 2 deletions firmware/PubRemote.sll
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"uiExportFolderPath": "...\\src\\ui",
"projectExportFolderPath": ".../",
"custom_variable_prefix": "uic",
"backup_cnt": 1439,
"backup_cnt": 1459,
"autosave_cnt": 0,
"group_color_cnt": 0,
"lvgl_version": "8.3.11",
Expand All @@ -43,5 +43,5 @@
"naming": "Name",
"naming_force_lowercase": false,
"naming_add_subcomponent": false,
"nidcnt": 1000429
"nidcnt": 1000501
}
9,924 changes: 3,564 additions & 6,360 deletions firmware/PubRemote.spj

Large diffs are not rendered by default.

36 changes: 36 additions & 0 deletions firmware/PubRemote_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,3 +278,39 @@ def update_secondary_button_press(event_struct):
def double_press_action_select_change(event_struct):
return


def stats_screen_gesture_down(event_struct):
return


def single_press_action_select_change(event_struct):
return


def long_press_action_select_change(event_struct):
return


def primary_stat_long_press(event_struct):
return


def primary_stat_swipe_left(event_struct):
return


def primary_stat_swipe_right(event_struct):
return


def secondary_stat_swipe_left(event_struct):
return


def secondary_stat_swipe_right(event_struct):
return


def secondary_stat_long_press(event_struct):
return

5 changes: 5 additions & 0 deletions firmware/src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,9 @@
#define HAPTIC_ENABLED 0
#endif

// Timezone configuration (default to US Eastern Time)
#ifndef DEFAULT_TIMEZONE
#define DEFAULT_TIMEZONE "EST5EDT,M3.2.0,M11.1.0"
#endif

#endif
5 changes: 5 additions & 0 deletions firmware/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,17 @@
#include "ui/ui.h"
#include <stdio.h>
#include <string.h>
#include <time.h>

static const char *TAG = "PUBREMOTE-MAIN";

#define DEBUG_MEMORY 0

void app_main(void) {
// Initialize timezone (default to US Eastern Time)
setenv("TZ", DEFAULT_TIMEZONE, 1);
tzset();

// Enable power for core peripherals
acc1_power_set_level(1);
// Core setup
Expand Down
4 changes: 3 additions & 1 deletion firmware/src/remote/powermanagement.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ static void power_state_update() {
is_power_connected = powerState.isPowered;
}

static bool get_button_pressed() {
bool get_button_pressed() {
return gpio_get_level(PRIMARY_BUTTON) == JOYSTICK_BUTTON_LEVEL;
}

Expand Down Expand Up @@ -441,7 +441,9 @@ void power_management_init() {
ESP_LOGI(TAG, "Not a deep sleep wakeup or other wake-up sources.");
break;
}

reset_sleep_timer();

if (get_button_pressed()) {
// Enable the power button once released if it wasn't already
register_primary_button_cb(BUTTON_EVENT_UP, power_button_initial_release);
Expand Down
1 change: 1 addition & 0 deletions firmware/src/remote/powermanagement.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define __POWERMANAGEMENT_H
#include "lvgl.h"

bool get_button_pressed();
void acc1_power_set_level(bool enable);
void acc2_power_set_level(uint8_t level);
void reset_sleep_timer();
Expand Down
1 change: 1 addition & 0 deletions firmware/src/remote/remoteinputs.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ void buttons_deinit() {
gpio_btn_handle = NULL;
}
}

void register_primary_button_cb(ButtonEvent event, button_callback_t cb) {
switch (event) {
case BUTTON_EVENT_DOWN:
Expand Down
18 changes: 16 additions & 2 deletions firmware/src/remote/settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ static const uint8_t DEFAULT_PEER_ADDR[6] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}
static const DarkTextOptions DEFAULT_DARK_TEXT = DARK_TEXT_DISABLED;
static const BoardBatteryDisplayOption DEFAULT_BATTERY_DISPLAY = BATTERY_DISPLAY_PERCENT;
static const PocketModeOptions DEFAULT_POCKET_MODE = POCKET_MODE_DISABLED;
static const StatsDoublePressAction DEFAULT_DOUBLE_PRESS_ACTION = DOUBLE_PRESS_ACTION_NONE;
static const StatsButtonPressAction DEFAULT_SINGLE_PRESS_ACTION = BUTTON_PRESS_ACTION_NONE;
static const StatsButtonPressAction DEFAULT_DOUBLE_PRESS_ACTION = BUTTON_PRESS_ACTION_NONE;
static const StatsButtonPressAction DEFAULT_LONG_PRESS_ACTION = BUTTON_PRESS_ACTION_SHUTDOWN;

DeviceSettings device_settings = {
.bl_level = BL_LEVEL_DEFAULT,
Expand All @@ -36,7 +38,9 @@ DeviceSettings device_settings = {
.dark_text = DEFAULT_DARK_TEXT,
.battery_display = DEFAULT_BATTERY_DISPLAY,
.pocket_mode = DEFAULT_POCKET_MODE,
.single_press_action = DEFAULT_SINGLE_PRESS_ACTION,
.double_press_action = DEFAULT_DOUBLE_PRESS_ACTION,
.long_press_action = DEFAULT_LONG_PRESS_ACTION,
};

CalibrationSettings calibration_settings = {
Expand Down Expand Up @@ -296,7 +300,9 @@ void save_device_settings() {
nvs_write_int("dark_text", device_settings.dark_text);
nvs_write_int("battery_display", device_settings.battery_display);
nvs_write_int("pocket_mode", device_settings.pocket_mode);
nvs_write_int("stats_sp", device_settings.single_press_action);
nvs_write_int("stats_dp", device_settings.double_press_action);
nvs_write_int("stats_lp", device_settings.long_press_action);
}

esp_err_t save_wifi_ssid(const char *ssid) {
Expand Down Expand Up @@ -503,10 +509,18 @@ esp_err_t settings_init() {
device_settings.pocket_mode =
nvs_read_int("pocket_mode", &temp_setting_value) == ESP_OK ? (bool)temp_setting_value : POCKET_MODE_DISABLED;

device_settings.single_press_action = nvs_read_int("stats_sp", &temp_setting_value) == ESP_OK
? (StatsButtonPressAction)temp_setting_value
: DEFAULT_SINGLE_PRESS_ACTION;

device_settings.double_press_action = nvs_read_int("stats_dp", &temp_setting_value) == ESP_OK
? (StatsDoublePressAction)temp_setting_value
? (StatsButtonPressAction)temp_setting_value
: DEFAULT_DOUBLE_PRESS_ACTION;

device_settings.long_press_action = nvs_read_int("stats_lp", &temp_setting_value) == ESP_OK
? (StatsButtonPressAction)temp_setting_value
: DEFAULT_LONG_PRESS_ACTION;

// Reading calibration settings
calibration_settings.x_min =
nvs_read_int("x_min", &temp_setting_value) == ESP_OK ? (uint16_t)temp_setting_value : STICK_MIN_VAL;
Expand Down
15 changes: 11 additions & 4 deletions firmware/src/remote/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,14 @@ typedef enum {
} PocketModeOptions;

typedef enum {
DOUBLE_PRESS_ACTION_NONE,
DOUBLE_PRESS_ACTION_OPEN_MENU,
} StatsDoublePressAction;
BUTTON_PRESS_ACTION_NONE,
BUTTON_PRESS_ACTION_SHUTDOWN,
BUTTON_PRESS_ACTION_OPEN_MENU,
BUTTON_PRESS_ACTION_TOGGLE_DISPLAY,
BUTTON_PRESS_ACTION_TOGGLE_POCKET_MODE,
BUTTON_PRESS_ACTION_CYCLE_SECONDARY_STAT,
BUTTON_PRESS_ACTION_CYCLE_BOARD_BATTERY_DISPLAY,
} StatsButtonPressAction;

#define DEFAULT_PAIRING_SECRET_CODE -1

Expand Down Expand Up @@ -121,7 +126,9 @@ typedef struct {
bool dark_text;
BoardBatteryDisplayOption battery_display;
PocketModeOptions pocket_mode;
StatsDoublePressAction double_press_action;
StatsButtonPressAction single_press_action;
StatsButtonPressAction double_press_action;
StatsButtonPressAction long_press_action;
} DeviceSettings;

uint64_t get_auto_off_ms();
Expand Down
1 change: 1 addition & 0 deletions firmware/src/screens/about_screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ void about_screen_load_start(lv_event_t *e) {

if (LVGL_lock(0)) {
apply_ui_scale(NULL);

update_version_info_label();
update_battery_percentage_label();
lv_obj_add_event_cb(ui_AboutBody, paged_scroll_event_cb, LV_EVENT_SCROLL, ui_AboutHeader);
Expand Down
2 changes: 2 additions & 0 deletions firmware/src/screens/calibration_screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,9 @@ void calibration_screen_load_start(lv_event_t *e) {

if (LVGL_lock(0)) {
apply_ui_scale(NULL);

create_navigation_group(ui_CalibrationFooter);

LVGL_unlock();
}
update_calibration_screen();
Expand Down
Loading