First iteration of menu cleanup
* Broke up the code into more general functions instead of duplicating code * Made stuff const and removed variables no longer used * Use defines for menu button values * Changed the order or things to avoid forward declarations * Use array lookup instead of switch-case on some menu options * Adjust menu functionification * Cleaned up sensor rendering
This commit is contained in:
parent
435ad106d8
commit
e362546e3c
6 changed files with 831 additions and 1428 deletions
31
NuEVI/numenu.h
Normal file
31
NuEVI/numenu.h
Normal file
|
@ -0,0 +1,31 @@
|
|||
#ifndef __NUMENU_H
|
||||
#define __NUMENU_H
|
||||
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
|
||||
#define MAX_DEPTH 16
|
||||
|
||||
class Adafruit_SSD1306;
|
||||
|
||||
class NuMenu
|
||||
{
|
||||
public:
|
||||
NuMenu(Adafruit_SSD1306 &gfx);
|
||||
|
||||
bool init();
|
||||
void update(uint16_t buttonState);
|
||||
|
||||
void setEnabled(bool state) { _enabled = state; }
|
||||
|
||||
static void drawMenuItems(const char* title, const char* entries[], int count, int selection, int offset = 0);
|
||||
|
||||
private:
|
||||
bool _enabled;
|
||||
// MenuPageState _rootMenu;
|
||||
// MenuPageState _pageStack[MAX_DEPTH];
|
||||
|
||||
Adafruit_SSD1306 &_display;
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue