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:
@@ -15,9 +15,9 @@ bool checkTimeout();
|
||||
//---------------------------
|
||||
//----- local variables -----
|
||||
//---------------------------
|
||||
cutter_state_t cutter_state = cutter_state_t::IDLE;
|
||||
uint32_t timestamp_turnedOn;
|
||||
uint32_t msTimeout = 3000;
|
||||
static cutter_state_t cutter_state = cutter_state_t::IDLE;
|
||||
static uint32_t timestamp_turnedOn;
|
||||
static uint32_t msTimeout = 3000;
|
||||
static const char *TAG = "cutter"; //tag for logging
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user