16 Commits

Author SHA1 Message Date
jonny
23cf6e6f3e Add Display-notification, default position, Push+scroll 2024-09-04 23:04:54 +02:00
jonny
c58c6b9b35 Add Mode-Select-Menu (1x long), (settings is 5x now)
General:
    - Rename control mode MENU to MENU_SETTINGS
    - Add new control mode MENU_MODE_SELECT

Button menu:
    - change 'long press' to: 'switch to menu mode-select'
    - move 'open settings menu' to 5x press

Display:
    - display_task: outsource statusScreen to local function
    - display_task: also handle MENU_MODE_SELECT control mode
    - show display startup message for 2600ms instead of 2000ms

Menu:
    - Add functions to handle modeSelect menu to select from a list of allowed modes
    (similar to settings main menu)
2024-05-28 21:20:20 +02:00
jonny_l480
bff6175fb0 Button: Scroll through status screens with rotating encoder
In any mode except MENU the encoder rotateion selects status screens

Add functions to rotate through available status screens
Aandle rotate encoder event in button menu
2024-05-20 17:00:46 +02:00
jonny
77ba81e996 WiFi on in HTTP-mode only, Add batt-threshold to timeout
As initially planned starting wifi only when needed, at change to HTTP mode.
Tested this on breakout board: ESP32 is not getting hot anymore!

Also optimized timeout: only notify "forgot to turn off" when battery is below certain
threshold (e.g. disable when charger is connected over night)

main:
    - dont start wifi at startup anymore
    - remove double-initialization of nvs
      already initialized in wifi.c, thus removed some code
    - optimize comments, logging

control:
    - timeout "forgot to turn off": Add battery threshold
    - start/stop wifi when switching to/from HTTP mode

wifi:
    - split init function to separate functions for NVS and NETIF (more clear in main)
    - optimize log output at nvs init (moved from main)
    - rename start/stop functions, formatting
2024-03-03 22:04:27 +01:00
jonny
3514dd6bf2 Add Brightness reduction at inactive, Optimize timeout
display.cpp:
    - add timeout where display brightness gets reduced
    - rework display-task loop to handle timeouts
    - run commands when changing from/to status-page (toggle scrolling)
    - add BRIGHTNESS_TEST option

config: Add display timeouts to config.cpp

control:
    - dont reset timeout at mode change (happens not always at user input)
    - remove deprecated config option
2024-03-02 13:06:55 +01:00
jonny_l480
0d082a52d8 Add Screensaver, Fix timeout
Add screensaver status screen to prevent oled burn-in:
  Display task switches to screensaver status-screen
  when certain time of inactivity is exceeded
2024-03-01 23:59:00 +01:00
jonny_l480
50ee4244d3 Fix bat voltage: lookup table, currentSensors: Add snap to zero
display.cpp:
    Optimize battery voltage measurement
    While calibrating noticed it is very non-linear
    - outsource function to scale using lookup table
    - add lookup table to batvoltage measurement
      inserted many values to lookup table while testing

currentsensors:
    Fix current value jumping around between 0 and 0.2 on display
    while standstill
    - add parameter snapToZeroThreshold
2024-02-27 12:24:38 +01:00
jonny_l480
aab30abb80 Display: Add Status screens 'Motors' and 'Joystick'
Add new status screens that can be selected in menu
(status screen = display content while not in MENU mode)

- display:
    - Motors screen: shows Power usage, duty, speed
    - Joystick screen: shows all stick data and current control mode (similar to 'debug joystick' menu option

- menu:
    - disable example menu items
    - add new status screens
2024-02-26 23:05:02 +01:00
jonny_jr9
ccef663c33 Fix chairAdjust, Add different status screens (Speed)
- config, chairAdjust:
    - disable reset-pin of display (not connected, random pin was assigned)
      same pin was used for chair adjust resulting in on state after startup
    - fix chairAdjust not stopping in OFF state

- display
    - add functionality to show different status screens (content when not in MENU)
    - add status screen 'Speed' (to show speed and debug speedsensors)

- menu
    - fix item joystick define center not working
    - add item to select status screen
2024-02-24 12:25:45 +01:00
jonny_jr9
cdfa64fbc0 Add joystick-calibration wizzard (store in nvs), Optimize Menu
- menu:
    - Add item joystick calibration wizzard
    - Add item RESET (clear nvs and restart)
    - Add configuration option to not show/change value. Instead only show confirm message
      apply this to all items only running action
    - Optimize formatting and comments

- main:
    - pass nvsHandle to display task and joystick class

- joystick:
    - Add methods to write and load calibration values (axis min/max adc value) from nvs
    - Add method to get raw adc value
2024-02-21 11:30:36 +01:00
jonny_jr9
021a3660e1 Outsource display, encoder cfg to config.cpp, Optimize speedsensor
- outsource configuration of display and encoder from source/header file
  to config.cpp and pass it to init function or task from main()

- optimize logging in several init functions

- speedsensor:
    - fix startup error: initialize ISR only once
    - create instances at initialization instead of first method call

- ssd1306 display library:
    - modify library to pass offsetX to init function instead of using macro
2024-02-20 12:24:41 +01:00
jonny_jr9
2fcf17feda Major Rework all files - Pass pointers to tasks, Remove gloabl variables
- All files:
  Modify almost all files to adjust functions and classes to
  work with pointers to objects passed at task creation
  instead of global variables from config.hpp

- Remove/clear config.hpp to get rid of all global variables

- main.cpp
    - Create pointer to all shared (used in multiple tasks) objects in main

- remove evaluatedSwitch button object,
  since joystick library is used to get switch events

- changes HTTP-mode
    - always init http-server (do not enable/disable at mode change)
    - pass url-handle function to init-htpp function
    - add lambda function to pass method of instance for thatMajor Rework all files - Remove global variables, pass pointers to tasks

- All files:
  Modify almost all files to adjust functions and classes to
  work with pointers to objects passed at task creation
  instead of global variables from config.hpp

- Remove/clear config.hpp to get rid of all global variables

- main.cpp
    - Create pointer to all shared (used in multiple tasks) objects in main

- remove evaluatedSwitch button object,
  since joystick library is used to get switch events

- changes HTTP-mode
    - always init http-server (do not enable/disable at mode change)
    - pass url-handle function to init-htpp function
    - add lambda function to pass method of instance for that

NOTES:  - tested on breakoutboard only
        - known issue that slow encoder events are not recognized
        (especially in menu) - slowing down motorctl helps
2024-02-18 10:00:34 +01:00
jonny_jr9
ffac657199 Add abstracted functions for display - simplify code
Simple functions for printing a line normal, large or centered
using format string directly instead of having to use both
snprintf first and then display function all the time
This makes the code more readable and compact

Applied this optimization where applicable in manu.cpp and display.cpp
2024-02-15 23:24:41 +01:00
jonny_l480
69a421a924 Outsource speedsensor, Display: show speed
- move speedsensor files from motorctl pcb to common
- single pcb create and configure global speedsensor objects
- display: create fast slow veryslow loop
  - clear display every 30s
  - show speed in rpm and km/h
  NOTE: speedsensor needs fix, direction unreliable
2023-09-12 16:00:20 +02:00
jonny_jr9
47d7e9f3a4 Rework display: separate task, add battery percent
slightly rework hacked display test
- new code structure
- split code in several functions
- add task for display instead of running it in main()
- functions to convert voltage to battery percent charged
- show percentage and voltage on display
2023-09-12 11:49:08 +02:00
jonny_jr9
0804aaf240 Add display library, show battery voltage
untested
2023-09-09 16:51:01 +02:00