16 Commits

Author SHA1 Message Date
jonny
4aab1e1343 Outsource global variables, Optimize comments
- outsource global variables and objects
    - move from config.hpp to global.cpp / hpp
    - rename config.hpp, thus change all includes
- re-arrange includes -> in source files instead of header

- optimize / make function comment titles more consistent
- optimize comments overall

- add several temporary files to gitignore
- fix unused variable compiler warnings
2024-03-10 12:55:13 +01:00
jonny_ji7
ac4ca5450a Fix variable scopes (static), Simplify encoder
- add static type to all local variables in every source file
  so the scope of each variable is limited to that file.
  This prevents conflicting variable names with other source file
  (e.g. 'state' variable in vfd.cpp)

- simplify encoder concept
  wrap all used functions from rotary_encoder.h library in
  custom encoder.hpp file
   -> only one file has to be included where encoder is used
   -> global variable 'encoder' is not necessary anymore
   -> reduces duplicate code for length calculation
- update all files where encoder functions where used accordingly
2023-03-01 01:00:16 +01:00
jonny_ji7
5b49406cb8 Add basic LAMP functionality; Fix comments
- Basic lamp functionality: simply turn on when not in COUNTING or TARGET_REACHED
    state

- Remove unnecessary comments, fix code formatting in several files
2022-09-22 11:23:48 +02:00
jonny_ji7
2cf1762569 Optimize auto-cut delay
Optimize delay to auto cut by adding a new state AUTO_CUT_WAITING
this removes some confusing / unnecessary complex code
2022-09-20 09:52:02 +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_l480
6242d6a5fc Merge branch 'main' into cutter 2022-09-12 13:48:58 +02: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
9600932ae8 Add cutter to control, test via preset buttons 2022-09-06 12:18:27 +02:00
jonny_ji7
586c335896 Create 'handledDisplay' class
To abstract rather complex functions for 7 segment displays e.g. blink text, scroll
text... a class was created.

This makes it possible to have 2 instances for displayTop and
displayBottom resulting in no duplicate code
2022-08-22 16:28:42 +02:00
jonny_ji7
01c5db39c1 Outsource display functions to display.cpp
move functions for initializing and writing to display to new files
display.cpp/hpp
2022-08-21 12:12:56 +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
8b9b5ff736 Add control statemachine, optimize vfd logging
Add all logic for the machine to control.cpp
optimize logging (on change only) for vfd functions
2022-08-18 14:23:32 +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
7fae539f14 Add vfd driver, Add vfd test via buttons
Add vfd.cpp/hpp with functions to control the VFD via 4 digital pins
Add way to test the vfd via SET button (rotate speed level) and START
button (toggle motor on/off)
2022-08-17 14:05:34 +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