22 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
5d7c67ab9a stepper-test: Control stepper with buttons
now the stepper test task controls the stepper using button input
this makes debugging modifications to stepper library easier
2023-03-24 13:22:22 +01:00
jonny_l480
28889bd912 Swap VFD and Stepper pin, Swap Encoder connection
- update config and connection plan
- swap B+ and B- of encoder to invert the rotational direction,
  so the direction in code make more sense
- swap VFD and stepper pin. For some reason stepper did not work with
  dir pin on mos2. Maybe pulse affected dir pin, try again with denoise
  pcb
2023-03-01 18:08:14 +01:00
jonny_ji7
118e9714b5 Add Stepper to connection-plan, Add datasheets
- Add datasheets of VFD and stepper driver
- Change pins in config for stepper driver
    - DISABLED LAMP (pin now used for stepper)
- update connection plan with stepper section and wiring
2023-03-01 08:35:19 +01:00
jonny_ji7
5dd392586d Outsource encoder code to encoder.cpp
To be able to use the encoder in future stepper task as well
- make certain variables global
- initialize encoder in main
- outsorce encoder functions in encoder.cpp / h
- adjust config
2023-03-01 00:09:29 +01:00
jonny_ji7
58c5a92d1e Add functional STEPPER_TEST feature
- add macro variable STEPPER_TEST (config.hpp)
    if set: only `task_stepper-test` is started (main.cpp)
- add file for stepper/guide related code (guide-stepper.cpp/hpp)
    currently defines a task that simply moves the axis left to right
    repeatedly with a speed defined by a potentiometer connected to ADC
    GPIO34
2023-02-21 21:27:33 +01:00
jonny_l480
ad2ce8c33b Adjust speed thresholds, increase custom length range
Update speed thresholds to slow down earlier
Increase custom length range from 30 to 50m
2022-10-11 11:48:54 +02:00
jonny_ji7
8f5b33c554 Add LENGTH_OFFSET and REACHED_TOLERANCE options
Add feature and config option #define TARGET_LENGTH_OFFSET
that makes it possible to set a distance that gets added to the target
length, thus preventing falling short on the actual length when spools
rotates back slightly after stop.

Also move reached tolerance to config.
2022-09-30 13:14:48 +02:00
jonny_ji7
992d852189 Add auto-cut functionality: diagram, switches, new state
control.cpp:
    - Add new systemState CUTTING
    - change systemState_t from enum to enum class (conflicting with
      cutter enum)

    - Add CUTTING functionality to CUT switch and auto cut after target
      reached if enabled

cutter.cpp:
    - Add function cutter_isRunning()

config:
    - Add GPIO_LAMP macro to config
2022-09-17 11:42:38 +02:00
jonny_ji7
824bad930e Add switches for cutter to con-plan and config 2022-09-17 10:37:39 +02:00
jonny_l480
6242d6a5fc Merge branch 'main' into cutter 2022-09-12 13:48:58 +02:00
jonny_ji7
451981b165 Rework switch-assignment, Update connection-plan
Rework config.cpp and config.hpp:
 - different naming convention for evaluated switch objects
 - thus updated macros for switches

 - add new evalswitch instances for 4 switches on 1 adc
 - update switch assignment, use the 4 new inputs

Update connection plan with new assignment, add stripboard details
2022-09-12 11:50:45 +02:00
jonny_ji7
d2d85952df Add evalSwitch instance for sw on adc (testing)
Test all new changes in switchesAnalog and evaluatedSwitch
2022-09-12 09:58:08 +02:00
jonny_ji7
09ee67f583 Add code for demuxing 4 switch signals from adc pin
- create new files with code for demultiplexing the 4 switches from the
  one analog signal
- define lookup table with measurements done with the build pcb, test
  switches and esp32 breakout board
- add note do config that gpio used for digital in is now used for
  this multiplexer
- main.cpp: disable control task, run new handle function in a loop for
  testing
2022-09-11 19:58:13 +02:00
jonny_ji7
bb22fb340d Add cutter code (cutter.cpp, cutter.hpp)
Add logic for cutter according to function diagram
Remove use of relay from vfd.cpp
Add pin for cutter switch to config
2022-09-06 12:00:23 +02:00
jonny_l480
248668c526 Add encoder-test, calibrate distance conversion
Add encoder test:
  - used for calibrating the length measurement by counting the steps
    per meter
  - enabled with #define ENCODER_TEST  in config.hpp
  - display1: enocder steps
  - display2: converted length in meter

Distance conversion:
  - defining STEPS_PER_METER instead of MEASURING_ROLL_DIAMETER in
    config.hpp
  - defining the steps per meter by issuing 3 test measurements with
    4mm2 solar cable in the new encoder test mode
2022-08-26 13:24:51 +02:00
jonny_ji7
9d416d29e6 Switch from 7.5kw vfd to 700W vfd
Already switched earlier, now optimized code and connection plan to work
best with new vfd (T130750W).
Previous 7.5kw vfd will work too without using all 7 speed levels as at
first.

connection plan: changed pin assignment (1 free pin)

Code:
  - vfd.cpp, main.cpp: remove not used D2 pin (only used with 7.5kw vfd)
  - config.hpp: change pin assignment
2022-08-26 11:24:27 +02:00
jonny_l480
5ddf8699e2 Change wheel diameter (larger wheel v3) 2022-08-20 14:17:40 +02:00
jonny_ji7
dddd54b03a Add MANUAL mode, Add vfd direction support
vfd: extend vfd_setState function with direction enum (default fwd)
main: reduce log output from buzzer task
config: use mos1 as vfd_FWD output
control:
    add MANUAL state: motor can be controlled via preset buttons
    adjust code slightly to support new state (also see updated
    function-diagram)
2022-08-19 16:29:59 +02:00
jonny_ji7
0aea494783 Add poti and display section; Cleanup
Add readadc function from armchair project
Rework display section
   - show lengthNow on first display
   - show lengthTarget on second display
Prepare for statemachine

Remove unneeded function
Add comments improve structure
2022-08-18 12:46:08 +02:00
jonny_ji7
22f8aef8d2 Move code from main to control.cpp, display pages
- move code from testing task to control.cpp
- outsource functions for initializing display and encoder
- delete testing code
- add two display pages (current distance and counter)
- run handle functions for each button
2022-08-17 13:08:05 +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