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
This commit is contained in:
jonny_ji7
2023-03-01 00:47:51 +01:00
parent 5dd392586d
commit ac4ca5450a
7 changed files with 89 additions and 47 deletions

View File

@@ -4,9 +4,9 @@
const char* vfd_directionStr[2] = {"FWD", "REV"};
static const char *TAG = "vfd";
uint8_t level = 0; //current speed level
bool state = false; //current state
vfd_direction_t direction = FWD; //current direction
static uint8_t level = 0; //current speed level
static bool state = false; //current state
static vfd_direction_t direction = FWD; //current direction
//=============================