add setupscreen - non working
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -18,4 +18,4 @@ lib_deps =
|
||||
adafruit/Adafruit ADS1X15@^2.2.0
|
||||
#olikraus/U8g2@^2.32.12
|
||||
build_flags =
|
||||
-DCORE_DEBUG_LEVEL=4
|
||||
-DCORE_DEBUG_LEVEL=3
|
||||
|
||||
@@ -1,129 +1,33 @@
|
||||
#include "display.h"
|
||||
|
||||
c_onScreenButton ma20("20m", mA20, LocBottom, BUTTON1);
|
||||
c_onScreenButton ma200("200m", mA200, LocBottom, BUTTON2);
|
||||
c_onScreenButton ma1000("1A", mA1000, LocBottom, BUTTON3);
|
||||
c_onScreenButton mauto("Auto", mAuto, LocBottom, BUTTON4);
|
||||
c_onScreenButton bsetup("Conf", 5, LocBottom, BUTTON5);
|
||||
c_onScreenButton errorState("ER", 6, LocRight, &getErrorState);
|
||||
c_onScreenButton okState("OK", 7, LocRight, &getOkState);
|
||||
c_onScreenButton openState("Open", 8, LocRight, &getOpenState);
|
||||
c_onScreenButton wifiState("Wifi", 9, LocRight, &getWifiState);
|
||||
e_displayState CurrentScreen;
|
||||
|
||||
std::vector<c_onScreenButton> MainScreen;
|
||||
|
||||
e_displayState CurrentGuiState;
|
||||
|
||||
void initDisplayGui(void)
|
||||
{
|
||||
log_i("Init GUI: ");
|
||||
uint16_t screenwidth = getDisplay()->getDisplayWidth();
|
||||
uint16_t buttonwidth = ((screenwidth / mLast) - CONTROLLOFFSET * 2 +1 );
|
||||
uint16_t currentWidth = 0;
|
||||
uint16_t ypos = getDisplay()->getDisplayHeight() - 1 - CONTROLSLINE_H + 2;
|
||||
|
||||
log_i("buttons: screenW=%d, buttonW=%d, ypos=%d", screenwidth, buttonwidth, ypos);
|
||||
//setup bottom buttons
|
||||
ma20.begin(currentWidth, ypos, buttonwidth, CONTROLSLINE_H + 6, CONTROLRADIUS);
|
||||
ma200.begin(currentWidth += (buttonwidth - 1), ypos, buttonwidth, CONTROLSLINE_H + CONTROLRADIUS, CONTROLRADIUS);
|
||||
ma1000.begin(currentWidth += (buttonwidth - 1), ypos, buttonwidth, CONTROLSLINE_H + CONTROLRADIUS, CONTROLRADIUS);
|
||||
mauto.begin(currentWidth += (buttonwidth - 1), ypos, buttonwidth, CONTROLSLINE_H + CONTROLRADIUS, CONTROLRADIUS);
|
||||
bsetup.begin(currentWidth += (buttonwidth - 1), ypos, buttonwidth, CONTROLSLINE_H + CONTROLRADIUS, CONTROLRADIUS);
|
||||
|
||||
//setup right side indicators
|
||||
uint16_t currentYpos = 0;
|
||||
uint16_t IndicatorXpos = screenwidth - INDICATORWIDTH;
|
||||
|
||||
log_i("indicators: indicW=%d, indicH=%d ypos,%d", INDICATORWIDTH, INDICATORHEIGHT,IndicatorXpos);
|
||||
|
||||
errorState.begin(IndicatorXpos, currentYpos, INDICATORWIDTH, INDICATORHEIGHT, INDICATORRADIUS);
|
||||
okState.begin(IndicatorXpos, currentYpos += (INDICATORHEIGHT - 1), INDICATORWIDTH, INDICATORHEIGHT, INDICATORRADIUS);
|
||||
openState.begin(IndicatorXpos, currentYpos += (INDICATORHEIGHT - 1), INDICATORWIDTH, INDICATORHEIGHT, INDICATORRADIUS);
|
||||
wifiState.begin(IndicatorXpos, currentYpos += (INDICATORHEIGHT - 1), INDICATORWIDTH, INDICATORHEIGHT, INDICATORRADIUS);
|
||||
|
||||
//fill vector
|
||||
log_i("Store");
|
||||
MainScreen.push_back(ma20);
|
||||
MainScreen.push_back(ma200);
|
||||
MainScreen.push_back(ma1000);
|
||||
MainScreen.push_back(mauto);
|
||||
MainScreen.push_back(bsetup);
|
||||
|
||||
MainScreen.push_back(errorState);
|
||||
MainScreen.push_back(okState);
|
||||
MainScreen.push_back(openState);
|
||||
MainScreen.push_back(wifiState);
|
||||
|
||||
for (auto &&button : MainScreen)
|
||||
{
|
||||
button.setVisible(true);
|
||||
}
|
||||
|
||||
CurrentGuiState = mainscreen;
|
||||
|
||||
log_i("OK");
|
||||
}
|
||||
|
||||
void drawMainSceenButtons()
|
||||
{
|
||||
//draw controlstrip indicators
|
||||
for (auto &&thismode : MainScreen)
|
||||
{
|
||||
thismode.setState((thismode.getIndex() == (uint8_t)getMeasureMode()));
|
||||
thismode.drawButton();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void drawMainscreenValues()
|
||||
{
|
||||
if (getDisplay() == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
drawDashedHLine(0, 12, 220);
|
||||
drawDashedVLine(40, 12, 33);
|
||||
getDisplay()->setFont(FONT8);
|
||||
getDisplay()->drawStr(5, 8, "Fs:100Hz LP");
|
||||
|
||||
getDisplay()->setFont(FONT24);
|
||||
|
||||
getDisplay()->setCursor(60, 45);
|
||||
getDisplay()->printf("%4.2f", getValue());
|
||||
uint16_t stringwidth = getDisplay()->getStrWidth(drawValue("", getValue(), "").c_str());
|
||||
getDisplay()->setFont(u8g2_font_8x13_t_symbols);
|
||||
getDisplay()->drawUTF8(60 + stringwidth + 3, 43, "mΩ");
|
||||
//drawProgressBar(0, 40, 127, 5, getBar());
|
||||
}
|
||||
|
||||
void handleDisplayButtons(void)
|
||||
{
|
||||
for (auto &&i : MainScreen)
|
||||
{
|
||||
i.handle();
|
||||
}
|
||||
}
|
||||
|
||||
void drawMainScreen()
|
||||
{
|
||||
drawMainSceenButtons();
|
||||
drawMainscreenValues();
|
||||
}
|
||||
|
||||
void handleDisplayGui(void)
|
||||
{
|
||||
clearDisplay();
|
||||
switch (CurrentGuiState)
|
||||
switch (CurrentScreen)
|
||||
{
|
||||
case mainscreen:
|
||||
{
|
||||
drawMainScreen();
|
||||
e_displayState nextScreen = ScreenMainHandle();
|
||||
if(nextScreen != CurrentScreen)
|
||||
{
|
||||
setDisplayState(nextScreen);
|
||||
}
|
||||
ScreenMainDrawValues();
|
||||
ScreenMainDrawButtons();
|
||||
}
|
||||
break;
|
||||
|
||||
case setupscreen:
|
||||
{
|
||||
e_displayState nextScreen = ScreenSetupHandle();
|
||||
if(nextScreen != CurrentScreen)
|
||||
{
|
||||
setDisplayState(nextScreen);
|
||||
}
|
||||
ScreenSetupDrawButtons();
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -131,19 +35,18 @@ void handleDisplayGui(void)
|
||||
|
||||
void setDisplayState(e_displayState newstate)
|
||||
{
|
||||
CurrentGuiState = newstate;
|
||||
CurrentScreen = newstate;
|
||||
}
|
||||
|
||||
|
||||
void initDisplay(void)
|
||||
{
|
||||
initDisplayHall();
|
||||
initDisplayGui();
|
||||
initDisplayMain();
|
||||
}
|
||||
|
||||
void handleDisplay(void)
|
||||
{
|
||||
handleDisplayButtons();
|
||||
handleDisplayGui();
|
||||
handleDisplayHall();
|
||||
}
|
||||
|
||||
@@ -1,18 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#include "Arduino.h"
|
||||
#include "display_types.h"
|
||||
#include "display_buttons.h"
|
||||
#include "display_hall.h"
|
||||
#include "display_draw.h"
|
||||
#include "screen_main.h"
|
||||
#include "screen_setup.h"
|
||||
#include "measure.h"
|
||||
#include "measure_mode.h"
|
||||
|
||||
typedef enum
|
||||
{
|
||||
mainscreen,
|
||||
setupscreen
|
||||
} e_displayState;
|
||||
|
||||
void initDisplay(void);
|
||||
void handleDisplay(void);
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ void c_onScreenButton::begin(uint16_t xpos, uint16_t ypos, uint16_t width, uint1
|
||||
log_d(":Calc_pos (pos=right, x=%d, y=%d, w=%d, h=%d, xT=%d, yT=%d)", _xpos, _ypos, _width, _height, _xTpos, _yTpos);
|
||||
}
|
||||
|
||||
if (_physButton.getPin() != -1)
|
||||
if (_physButton.isValid())
|
||||
{
|
||||
log_d("init pyhsButton(%d)", _index);
|
||||
_physButton.begin();
|
||||
@@ -45,9 +45,9 @@ void c_onScreenButton::drawButton()
|
||||
getDisplay()->drawBox(_xpos, _ypos, _width, _height);
|
||||
getDisplay()->setDrawColor(1);
|
||||
|
||||
uint16_t yTpos_pressed = !_pressed ? _yTpos : (_yTpos + 1);
|
||||
uint16_t yTpos_pressed = !getState() ? _yTpos : (_yTpos + 1);
|
||||
|
||||
if (getState())
|
||||
if (getDisplayState())
|
||||
{
|
||||
getDisplay()->drawRBox(_xpos, _ypos, _width, _height, _radius);
|
||||
getDisplay()->setDrawColor(0);
|
||||
@@ -75,8 +75,13 @@ void c_onScreenButton::handle()
|
||||
setMeasureMode(_mode);
|
||||
}
|
||||
}
|
||||
|
||||
log_d("read_button(%d) = %d", _physButton.getPin(), _pressed);
|
||||
_state = _pressed;
|
||||
}
|
||||
else if (_stateFn != NULL)
|
||||
{
|
||||
_state = _stateFn();
|
||||
}
|
||||
log_i("item(%s)=%d",_name.c_str(), _state);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ class c_onScreenButton
|
||||
bool (*const _stateFn)();
|
||||
c_button _physButton;
|
||||
|
||||
|
||||
uint16_t _xpos;
|
||||
uint16_t _ypos;
|
||||
uint16_t _xTpos;
|
||||
@@ -45,9 +46,13 @@ class c_onScreenButton
|
||||
e_buttonLoc _location;
|
||||
|
||||
bool _state;
|
||||
bool _displayState;
|
||||
bool _pressed;
|
||||
bool _visible;
|
||||
|
||||
|
||||
void setState(bool state) { _state = state; }
|
||||
|
||||
public:
|
||||
c_onScreenButton(String name, e_measureMode mode, e_buttonLoc location, uint8_t pin) : _name(name),
|
||||
_index((uint8_t)mode),
|
||||
@@ -59,6 +64,7 @@ public:
|
||||
_visible = false;
|
||||
_pressed = false;
|
||||
_state = false;
|
||||
_displayState = false;
|
||||
_mode = mode;
|
||||
_location = location;
|
||||
}
|
||||
@@ -73,6 +79,7 @@ public:
|
||||
_visible = false;
|
||||
_pressed = false;
|
||||
_state = false;
|
||||
_displayState = false;
|
||||
_mode = e_measureMode::mNone;
|
||||
_location = location;
|
||||
}
|
||||
@@ -94,17 +101,10 @@ public:
|
||||
|
||||
void drawButton();
|
||||
void begin(uint16_t xpos, uint16_t ypos, uint16_t width, uint16_t height, uint16_t radius);
|
||||
void setState(bool state) { _state = state; }
|
||||
bool getState(void)
|
||||
{
|
||||
if (_stateFn != NULL)
|
||||
{
|
||||
// log_if("%s: call stateFn\n",_name.c_str());
|
||||
return _stateFn();
|
||||
}
|
||||
return _state;
|
||||
}
|
||||
void handle();
|
||||
void setDisplayState(bool newState) { _displayState = newState; }
|
||||
bool getState(void) { return _state; }
|
||||
bool getDisplayState(void) { return _displayState; }
|
||||
void handle(void);
|
||||
void setVisible(bool state) { _visible = state; }
|
||||
bool getVisible(void) { return _visible; }
|
||||
uint8_t getIndex(void) { return _index; }
|
||||
|
||||
9
MilliOhmMeter_FW/src/display_types.h
Normal file
9
MilliOhmMeter_FW/src/display_types.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include "Arduino.h"
|
||||
|
||||
typedef enum
|
||||
{
|
||||
mainscreen,
|
||||
setupscreen
|
||||
} e_displayState;
|
||||
@@ -1,23 +1,23 @@
|
||||
#include "gain_control.h"
|
||||
|
||||
c_gainControl modeNone(e_measureMode::mNone, 0, 0, 0, 0, 0, 0);
|
||||
c_gainControl mode20mA(e_measureMode::mA20, 1, 1, 0, 0, 1, 1);
|
||||
c_gainControl mode200mA(e_measureMode::mA200, 1, 1, 0, 0, 1, 1);
|
||||
c_gainControl mode1000mA(e_measureMode::mA1000, 1, 1, 0, 0, 1, 1);
|
||||
|
||||
|
||||
/* mode UC1 2 3 4 5 6
|
||||
gain 0,5 1 5 50 - -
|
||||
Source - - - - 2 10 *100mA ( none = 20mA )*/
|
||||
c_gainControl mode20mA(e_measureMode::mA20, 0, 0, 0, 1, 0, 0);
|
||||
c_gainControl mode200mA(e_measureMode::mA200, 0, 0, 1, 0, 1, 0);
|
||||
c_gainControl mode1000mA(e_measureMode::mA1000, 0, 1, 0, 0, 0, 1); //warning not automatic
|
||||
|
||||
//UC02 > G=1 (met JP5naar 1000mA); UC03 > G=5(met JP7 naar 200mA); UC04 > G=50 (@20mA); UC05 > 1000mA; UC06 > 200mA. Current: niets gekozen = 20mA.
|
||||
|
||||
|
||||
std::vector<c_gainControl> gainList;
|
||||
|
||||
e_measureMode lastGain = e_measureMode::mNone;
|
||||
e_measureMode lastGain = e_measureMode::mA20;
|
||||
|
||||
void initGainControl(void)
|
||||
{
|
||||
gainList.push_back(modeNone);
|
||||
gainList.push_back(mode20mA);
|
||||
gainList.push_back(mode200mA);
|
||||
gainList.push_back(mode1000mA);
|
||||
}
|
||||
|
||||
void handleGainControl(void)
|
||||
@@ -57,5 +57,5 @@ void resetGain(void)
|
||||
{
|
||||
gain.deactivate();
|
||||
}
|
||||
setGain(mNone);
|
||||
setGain(mA20);
|
||||
}
|
||||
@@ -23,5 +23,5 @@ void loop()
|
||||
handleMeasure();
|
||||
handleGainControl();
|
||||
handleDisplay();
|
||||
log_i("T=%4.2fms\n", (double)(micros() - looptime)/1000);
|
||||
log_d("T=%4.2fms\n", (double)(micros() - looptime)/1000);
|
||||
}
|
||||
@@ -41,7 +41,7 @@ uint8_t getBar(void)
|
||||
|
||||
float getValue(void)
|
||||
{
|
||||
log_i("ADCvolts:%4.2fV\n",getMeasurement());
|
||||
log_d("ADCvolts:%4.2fV\n",getMeasurement());
|
||||
return getMeasurement();
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,18 @@ e_measureStates lastMeasureState = e_measureStates::stateInit;
|
||||
|
||||
uint32_t lastMeasureTime = 0;
|
||||
|
||||
String s_measureState[lastState+1] =
|
||||
{
|
||||
"init",
|
||||
"idle",
|
||||
"connected",
|
||||
"allGood",
|
||||
"Open",
|
||||
"Error",
|
||||
"FatalError",
|
||||
"invalidstate"
|
||||
};
|
||||
|
||||
void setMeasureState(e_measureStates newState)
|
||||
{
|
||||
if (currentMeasureState != e_measureStates::stateError && currentMeasureState != e_measureStates::stateFatalError )
|
||||
|
||||
@@ -18,17 +18,6 @@ typedef enum
|
||||
lastState
|
||||
}e_measureStates;
|
||||
|
||||
String s_measureState[lastState+1] =
|
||||
{
|
||||
"init",
|
||||
"idle",
|
||||
"connected",
|
||||
"allGood",
|
||||
"Open",
|
||||
"Error",
|
||||
"FatalError",
|
||||
"invalidstate"
|
||||
};
|
||||
|
||||
void initMeasureState(void);
|
||||
void handleMeasureState(void);
|
||||
|
||||
107
MilliOhmMeter_FW/src/screen_main.cpp
Normal file
107
MilliOhmMeter_FW/src/screen_main.cpp
Normal file
@@ -0,0 +1,107 @@
|
||||
#include "screen_main.h"
|
||||
|
||||
c_onScreenButton ma20("20m", mA20, LocBottom, BUTTON1);
|
||||
c_onScreenButton ma200("200m", mA200, LocBottom, BUTTON2);
|
||||
c_onScreenButton ma1000("1A", mA1000, LocBottom, BUTTON3);
|
||||
c_onScreenButton mauto("Auto", mAuto, LocBottom, BUTTON4);
|
||||
c_onScreenButton bsetup("Conf", 5, LocBottom, BUTTON5);
|
||||
c_onScreenButton errorState("ER", 6, LocRight, &getErrorState);
|
||||
c_onScreenButton okState("OK", 7, LocRight, &getOkState);
|
||||
c_onScreenButton openState("Open", 8, LocRight, &getOpenState);
|
||||
c_onScreenButton wifiState("Wifi", 9, LocRight, &getWifiState);
|
||||
|
||||
std::vector<c_onScreenButton*> MainScreen;
|
||||
const e_displayState thisScreen = e_displayState::mainscreen;
|
||||
|
||||
void initDisplayMain(void)
|
||||
{
|
||||
log_i("Setup main screen : ");
|
||||
uint16_t screenwidth = getDisplay()->getDisplayWidth();
|
||||
uint16_t buttonwidth = ((screenwidth / mLast) - CONTROLLOFFSET * 2 + 1);
|
||||
uint16_t currentWidth = 0;
|
||||
uint16_t ypos = getDisplay()->getDisplayHeight() - 1 - CONTROLSLINE_H + 2;
|
||||
|
||||
log_i("buttons: screenW=%d, buttonW=%d, ypos=%d", screenwidth, buttonwidth, ypos);
|
||||
// setup bottom buttons
|
||||
ma20.begin(currentWidth, ypos, buttonwidth, CONTROLSLINE_H + 6, CONTROLRADIUS);
|
||||
ma200.begin(currentWidth += (buttonwidth - 1), ypos, buttonwidth, CONTROLSLINE_H + CONTROLRADIUS, CONTROLRADIUS);
|
||||
ma1000.begin(currentWidth += (buttonwidth - 1), ypos, buttonwidth, CONTROLSLINE_H + CONTROLRADIUS, CONTROLRADIUS);
|
||||
mauto.begin(currentWidth += (buttonwidth - 1), ypos, buttonwidth, CONTROLSLINE_H + CONTROLRADIUS, CONTROLRADIUS);
|
||||
bsetup.begin(currentWidth += (buttonwidth - 1), ypos, buttonwidth, CONTROLSLINE_H + CONTROLRADIUS, CONTROLRADIUS);
|
||||
|
||||
// setup right side indicators
|
||||
uint16_t currentYpos = 0;
|
||||
uint16_t IndicatorXpos = screenwidth - INDICATORWIDTH;
|
||||
|
||||
log_i("indicators: indicW=%d, indicH=%d ypos,%d", INDICATORWIDTH, INDICATORHEIGHT, IndicatorXpos);
|
||||
|
||||
errorState.begin(IndicatorXpos, currentYpos, INDICATORWIDTH, INDICATORHEIGHT, INDICATORRADIUS);
|
||||
okState.begin(IndicatorXpos, currentYpos += (INDICATORHEIGHT - 1), INDICATORWIDTH, INDICATORHEIGHT, INDICATORRADIUS);
|
||||
openState.begin(IndicatorXpos, currentYpos += (INDICATORHEIGHT - 1), INDICATORWIDTH, INDICATORHEIGHT, INDICATORRADIUS);
|
||||
wifiState.begin(IndicatorXpos, currentYpos += (INDICATORHEIGHT - 1), INDICATORWIDTH, INDICATORHEIGHT, INDICATORRADIUS);
|
||||
|
||||
// fill vector
|
||||
log_i("Store main screen items");
|
||||
MainScreen.push_back(&ma20);
|
||||
MainScreen.push_back(&ma200);
|
||||
MainScreen.push_back(&ma1000);
|
||||
MainScreen.push_back(&mauto);
|
||||
MainScreen.push_back(&bsetup);
|
||||
|
||||
MainScreen.push_back(&errorState);
|
||||
MainScreen.push_back(&okState);
|
||||
MainScreen.push_back(&openState);
|
||||
MainScreen.push_back(&wifiState);
|
||||
|
||||
for (auto &&button : MainScreen)
|
||||
{
|
||||
button->setVisible(true);
|
||||
}
|
||||
|
||||
log_i("mainscreen OK");
|
||||
}
|
||||
|
||||
void ScreenMainDrawButtons(void)
|
||||
{
|
||||
// draw controlstrip indicators
|
||||
for (auto &&thismode : MainScreen)
|
||||
{
|
||||
thismode->setDisplayState((thismode->getIndex() == (uint8_t)getMeasureMode()));
|
||||
thismode->drawButton();
|
||||
}
|
||||
}
|
||||
|
||||
void ScreenMainDrawValues(void)
|
||||
{
|
||||
if (getDisplay() == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
drawDashedHLine(0, 12, 220);
|
||||
drawDashedVLine(40, 12, 33);
|
||||
getDisplay()->setFont(FONT8);
|
||||
getDisplay()->drawStr(5, 8, "Fs:100Hz LP");
|
||||
|
||||
getDisplay()->setFont(FONT24);
|
||||
|
||||
getDisplay()->setCursor(60, 45);
|
||||
getDisplay()->printf("%4.2f", getValue());
|
||||
uint16_t stringwidth = getDisplay()->getStrWidth(drawValue("", getValue(), "").c_str());
|
||||
getDisplay()->setFont(u8g2_font_8x13_t_symbols);
|
||||
getDisplay()->drawUTF8(60 + stringwidth + 3, 43, "mΩ");
|
||||
}
|
||||
|
||||
e_displayState ScreenMainHandle(void)
|
||||
{
|
||||
for (auto &&i : MainScreen)
|
||||
{
|
||||
i->handle();
|
||||
}
|
||||
|
||||
if(bsetup.getState())
|
||||
{
|
||||
return e_displayState::setupscreen;
|
||||
}
|
||||
return thisScreen;
|
||||
}
|
||||
11
MilliOhmMeter_FW/src/screen_main.h
Normal file
11
MilliOhmMeter_FW/src/screen_main.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "Arduino.h"
|
||||
#include "display_types.h"
|
||||
#include "display_draw.h"
|
||||
#include "display_buttons.h"
|
||||
|
||||
void initDisplayMain(void);
|
||||
void ScreenMainDrawValues(void);
|
||||
void ScreenMainDrawButtons(void);
|
||||
e_displayState ScreenMainHandle(void);
|
||||
53
MilliOhmMeter_FW/src/screen_setup.cpp
Normal file
53
MilliOhmMeter_FW/src/screen_setup.cpp
Normal file
@@ -0,0 +1,53 @@
|
||||
#include "screen_setup.h"
|
||||
|
||||
c_onScreenButton bback("<", mA20, LocBottom, BUTTON1);
|
||||
c_onScreenButton bforw(">", mA200, LocBottom, BUTTON2);
|
||||
c_onScreenButton bOK("OK", mA1000, LocBottom, BUTTON3);
|
||||
c_onScreenButton bGame("Game", mAuto, LocBottom, BUTTON4);
|
||||
c_onScreenButton bExit("Exit", 5, LocBottom, BUTTON5);
|
||||
|
||||
std::vector<c_onScreenButton *> SetupScreen;
|
||||
const e_displayState thisScreen = e_displayState::setupscreen;
|
||||
|
||||
void initSetupScreen(void)
|
||||
{
|
||||
uint16_t screenwidth = getDisplay()->getDisplayWidth();
|
||||
uint16_t buttonwidth = ((screenwidth / mLast) - CONTROLLOFFSET * 2 + 1);
|
||||
uint16_t currentWidth = 0;
|
||||
uint16_t ypos = getDisplay()->getDisplayHeight() - 1 - CONTROLSLINE_H + 2;
|
||||
|
||||
bback.begin(currentWidth, ypos, buttonwidth, CONTROLSLINE_H + 6, CONTROLRADIUS);
|
||||
bforw.begin(currentWidth += (buttonwidth - 1), ypos, buttonwidth, CONTROLSLINE_H + CONTROLRADIUS, CONTROLRADIUS);
|
||||
bOK.begin(currentWidth += (buttonwidth - 1), ypos, buttonwidth, CONTROLSLINE_H + CONTROLRADIUS, CONTROLRADIUS);
|
||||
bGame.begin(currentWidth += (buttonwidth - 1), ypos, buttonwidth, CONTROLSLINE_H + CONTROLRADIUS, CONTROLRADIUS);
|
||||
bExit.begin(currentWidth += (buttonwidth - 1), ypos, buttonwidth, CONTROLSLINE_H + CONTROLRADIUS, CONTROLRADIUS);
|
||||
|
||||
SetupScreen.push_back(&bback);
|
||||
SetupScreen.push_back(&bforw);
|
||||
SetupScreen.push_back(&bOK);
|
||||
SetupScreen.push_back(&bGame);
|
||||
SetupScreen.push_back(&bExit);
|
||||
}
|
||||
|
||||
void ScreenSetupDrawButtons(void)
|
||||
{
|
||||
// draw controlstrip indicators
|
||||
for (auto &&thismode : SetupScreen)
|
||||
{
|
||||
thismode->drawButton();
|
||||
}
|
||||
}
|
||||
|
||||
e_displayState ScreenSetupHandle(void)
|
||||
{
|
||||
for (auto &&i : SetupScreen)
|
||||
{
|
||||
i->handle();
|
||||
}
|
||||
|
||||
if(bExit.getState())
|
||||
{
|
||||
return e_displayState::mainscreen;
|
||||
}
|
||||
return thisScreen;
|
||||
}
|
||||
10
MilliOhmMeter_FW/src/screen_setup.h
Normal file
10
MilliOhmMeter_FW/src/screen_setup.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include "Arduino.h"
|
||||
#include "display_types.h"
|
||||
#include "display_buttons.h"
|
||||
|
||||
void initSetupScreen(void);
|
||||
|
||||
e_displayState ScreenSetupHandle(void);
|
||||
void ScreenSetupDrawButtons(void);
|
||||
Reference in New Issue
Block a user