13 Commits

Author SHA1 Message Date
jonny_l480
279ac0e07e Add more debug output ISSUES
- Add debug output in calc
- disable test mode for testing with encoder
- set loglevel to DEBUG

extend feature currently only works well in testing mode with buttons
issues when running with encoder:
 movement gets extended extremely often due to encoder travel
 interval and rarely does reach target - compared to trigger with
 buttons
 -> while debugging noticed that the current speed gets negative
 and the xISR gets stuck so moves infinitely or not at all

 ideas:
 - rounding issue?
 - SPEED increment also has to be adjusted or set to 0 as step
   increment?
2023-03-26 11:41:46 +02:00
jonny_l480
1c59e0097b Fix feature: extend movement works now! (test mode)
while currently in stepper test mode the extend feature works as
intended now.
you can trigger movement using the buttons and repeating
presses while still moving (coast, accel or decel) extends the movement
without stopping or accelerating again.

Note reversing the direction while still moving is not handled and results
in immediate direction change and distance that makes no sense.

also added alot of debug output and switched to debug level
2023-03-24 15:05:36 +01:00
jonny_l480
8d2428d285 Stepper: Add calc debug output ISSUES
- sometimes deadlock at direction change
    waits for idle state in runAbs
    function, but stepper is not really moving anymore  ISR does not change
    to idle or state changed afterwards?
- every EXTEND operation results in a motor stop thus when extending
    alot is stopped only ramping up and down
    when encoder stop after several extend attempts
    the stepper moves all the remaining steps successfully
2023-03-13 20:25:10 +01:00
jonny_ji7
dc6deeb3d0 Stepper: rework resume functionality 2023-03-13 20:02:22 +01:00
jonny_l480
0a05340763 revert mutex, fix state reset, logging, slower
stepsRemaining not necessary in ISR
comment out forced stop at runAbs
statusPrev not needed
TODO: ISR defines state every time, no need to adjust manually while running
adjust calc function to handle remaining steps

Test: broken - slow moves mork but when "extending" movement it just
vibrates
2023-03-13 18:26:50 +01:00
jonny_ji7
45409676a0 Stepper: add mutex, logging, delay, less steps
When testing last commit the stepper task crashed almost instantly and
moved randomly. Trying to fix/debug that with those changes
2023-03-13 11:12:42 +01:00
jonny_ji7
de42b6252e Stepper: Add resume/update functionality (WIP)
add way to extend current move operation without having to wait for IDLE
state (full decel time)
2023-03-12 13:06:30 +01:00
jonny_ji7
2651a83ce7 Add stepper library for esp-idf 2023-02-21 21:14:16 +01:00
jonny_ji7
1f53fabd19 Create gpio_adc component - outsource readAdc()
remove duplicate code:
function readAdc was used in multiple files, outsourced this to gpio
component
2022-09-12 11:19:47 +02:00
jonny_ji7
a932460924 EvalSwitch: Add func as source, remove dupl code
evaluatedSwitch component:
- remove duplicate code for inverted and non-inverted mode
- add new constructor for instance with a function to obtain current
  input state instead of gpio pin (e.g. needed for 4switches on analog input)
2022-09-12 09:47:06 +02:00
jonny_ji7
9f329101a1 Fix bug display lib: random characters flickering
Fix bug in display library where random chars were written to display even
though the array has ended.
Resulting in random character appearing briefly when only first display got written.

-> stop loop when 0-termination of char array is reached
2022-08-22 22:22:45 +02:00
jonny_ji7
a3f3cb340c Add config, buzzer, evalSwitch, switch to c++
Add config.cpp/hpp
    - macros for all input and output pins
    - gloabl evaluated switch objects
    - buzzer object
    - display config
    - encoder config

Move main.c to main.cpp and adjust code to be c++ compatible

add custom library evaluated switch (copied from armchair project)
add buzzer object (copied from armchair project)

add control.cpp/hpp with control task (no function yet)
2022-08-17 10:29:11 +02:00
jonny_ji7
307cad4a9a init - display test
new idf project (with  idf.py create-project)
add 2 components for encoder and display:
    https://github.com/DavidAntliff/esp32-rotary-encoder
    https://github.com/UncleRus/esp-idf-lib/tree/master/components/max7219
add code for testing a 7 segment display
2022-08-06 09:28:38 +02:00