state-handler: #6 prepare for displaying values
Add internal fucntionality for: - getBarPressure() - getBarSpeed() - displaySet(int, int)
This commit is contained in:
parent
2b2ffb6dcf
commit
ff94a455a5
@ -48,6 +48,7 @@
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc://inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/DigitalIoPin/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/LiquidCrystal/inc}""/>
|
||||
</option>
|
||||
<option id="com.crt.advproject.cpp.misc.dialect.1047276372" name="Language standard" superClass="com.crt.advproject.cpp.misc.dialect" useByScannerDiscovery="true" value="com.crt.advproject.misc.dialect.c++11" valueType="enumerated"/>
|
||||
<inputType id="com.crt.advproject.compiler.cpp.input.1472075573" superClass="com.crt.advproject.compiler.cpp.input"/>
|
||||
@ -71,6 +72,7 @@
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc://inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/DigitalIoPin/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/LiquidCrystal/inc}""/>
|
||||
</option>
|
||||
<option id="com.crt.advproject.c.misc.dialect.1367957643" name="Language standard" superClass="com.crt.advproject.c.misc.dialect" useByScannerDiscovery="true" value="com.crt.advproject.misc.dialect.c11" valueType="enumerated"/>
|
||||
<option id="com.crt.advproject.gcc.hdrlib.1476293714" name="Library headers" superClass="com.crt.advproject.gcc.hdrlib" useByScannerDiscovery="false" value="Newlib" valueType="enumerated"/>
|
||||
@ -87,6 +89,7 @@
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc://inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/DigitalIoPin/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/LiquidCrystal/inc}""/>
|
||||
</option>
|
||||
<option id="com.crt.advproject.gas.hdrlib.925707249" name="Library headers" superClass="com.crt.advproject.gas.hdrlib" value="Newlib" valueType="enumerated"/>
|
||||
<option id="com.crt.advproject.gas.specs.1146689581" name="Specs" superClass="com.crt.advproject.gas.specs" value="com.crt.advproject.gas.specs.newlib" valueType="enumerated"/>
|
||||
@ -149,6 +152,7 @@
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc://inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/DigitalIoPin/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/LiquidCrystal/inc}""/>
|
||||
</option>
|
||||
<option id="com.crt.advproject.cpp.misc.dialect.2103564035" name="Language standard" superClass="com.crt.advproject.cpp.misc.dialect" useByScannerDiscovery="true" value="com.crt.advproject.misc.dialect.c++11" valueType="enumerated"/>
|
||||
<option id="com.crt.advproject.cpp.hdrlib.1905759872" name="Library headers" superClass="com.crt.advproject.cpp.hdrlib" useByScannerDiscovery="false" value="Newlib" valueType="enumerated"/>
|
||||
@ -173,6 +177,7 @@
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc://inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/DigitalIoPin/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/LiquidCrystal/inc}""/>
|
||||
</option>
|
||||
<option id="com.crt.advproject.c.misc.dialect.1578394517" name="Language standard" superClass="com.crt.advproject.c.misc.dialect" useByScannerDiscovery="true" value="com.crt.advproject.misc.dialect.c11" valueType="enumerated"/>
|
||||
<option id="com.crt.advproject.gcc.hdrlib.339012185" name="Library headers" superClass="com.crt.advproject.gcc.hdrlib" useByScannerDiscovery="false" value="Newlib" valueType="enumerated"/>
|
||||
@ -189,6 +194,7 @@
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_15xx/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc://inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/DigitalIoPin/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/LiquidCrystal/inc}""/>
|
||||
</option>
|
||||
<option id="com.crt.advproject.gas.hdrlib.1849085416" name="Library headers" superClass="com.crt.advproject.gas.hdrlib" value="Newlib" valueType="enumerated"/>
|
||||
<option id="com.crt.advproject.gas.specs.451573115" name="Specs" superClass="com.crt.advproject.gas.specs" value="com.crt.advproject.gas.specs.newlib" valueType="enumerated"/>
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
<projects>
|
||||
<project>lpc_chip_15xx</project>
|
||||
<project>DigitalIoPin</project>
|
||||
<project>LiquidCrystal</project>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
|
||||
@ -1,5 +1,10 @@
|
||||
../src/StateHandler.cpp:10:1:StateHandler::StateHandler(EVENT_HANDL) 16 static
|
||||
../src/StateHandler.cpp:15:1:StateHandler::~StateHandler() 16 static
|
||||
../src/StateHandler.cpp:15:1:virtual StateHandler::~StateHandler() 16 static
|
||||
../src/StateHandler.cpp:19:5:int StateHandler::getSetPresuure() 16 static
|
||||
../src/StateHandler.cpp:24:5:int StateHandler::getSetSpeed() 16 static
|
||||
/home/tylen/Desktop/Programming/Projects_Metropolia/ESP-Ventilation/StateHandler/inc/Event.h:13:11:Event::~Event() 16 static
|
||||
/home/tylen/Desktop/Programming/Projects_Metropolia/ESP-Ventilation/StateHandler/inc/Event.h:13:11:virtual Event::~Event() 16 static
|
||||
/home/tylen/Desktop/Programming/Projects_Metropolia/ESP-Ventilation/StateHandler/inc/Event.h:26:3:Event::Event(Event::eventType, int, int) 24 static
|
||||
../src/StateHandler.cpp:10:1:StateHandler::StateHandler() 16 static
|
||||
../src/StateHandler.cpp:14:1:StateHandler::~StateHandler() 16 static
|
||||
../src/StateHandler.cpp:14:1:virtual StateHandler::~StateHandler() 16 static
|
||||
../src/StateHandler.cpp:18:14:unsigned int StateHandler::getSetPressure() 16 static
|
||||
../src/StateHandler.cpp:22:14:unsigned int StateHandler::getSetSpeed() 16 static
|
||||
../src/StateHandler.cpp:26:6:void StateHandler::HandleState(const Event&) 16 static
|
||||
../src/StateHandler.cpp:30:6:void StateHandler::SetState(state_pointer) 64 static
|
||||
|
||||
@ -14,7 +14,7 @@ public:
|
||||
Counter(int i, int up);
|
||||
void inc();
|
||||
void dec();
|
||||
int getInit();
|
||||
int getCurrent();
|
||||
void setInit(int i);
|
||||
~Counter() = default;
|
||||
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
#define STATE_HANDLER_H_
|
||||
|
||||
#include "DigitalIoPin.h"
|
||||
#include "LiquidCrystal.h"
|
||||
#include "Counter.h"
|
||||
#include "Event.h"
|
||||
|
||||
@ -41,16 +42,45 @@ enum _buttons {
|
||||
BUTTON_CONTROL_TOG_ACTIVE
|
||||
};
|
||||
|
||||
enum _bars {
|
||||
/** 0-100 % */
|
||||
FAN_SPEED,
|
||||
/** 0-120 Pa */
|
||||
PRESSURE
|
||||
};
|
||||
|
||||
enum _mode {
|
||||
MANUAL,
|
||||
AUTO
|
||||
};
|
||||
|
||||
class StateHandler;
|
||||
typedef void (StateHandler::*state_pointer)(const Event &);
|
||||
|
||||
|
||||
class StateHandler {
|
||||
public:
|
||||
StateHandler();
|
||||
StateHandler(LiquidCrystal * lcd);
|
||||
virtual ~StateHandler();
|
||||
int getSetPresuure(); // Get currently set pressure 0-100%
|
||||
int getSetSpeed(); //Get currently set FanSpeed 0-100%
|
||||
|
||||
/** Get currently set pressure
|
||||
*
|
||||
* @return pressure in range of 0-120
|
||||
*/
|
||||
unsigned int getSetPressure();
|
||||
|
||||
/** Get currently set FanSpeed
|
||||
*
|
||||
* @return speed in range of 0-100
|
||||
*/
|
||||
unsigned int getSetSpeed();
|
||||
|
||||
/** Display values on LCD depending on current mode
|
||||
*
|
||||
* @param value1 value to be displayed on LCD line 0
|
||||
* @param value2 value to be displayed on LCD line 1
|
||||
*/
|
||||
void displaySet(unsigned int value1, unsigned int value2);
|
||||
|
||||
/** Handle the given event of the current state
|
||||
* @param event event to be handled in the current state
|
||||
@ -62,9 +92,9 @@ private:
|
||||
* @param newstate new state to be set to current
|
||||
*/
|
||||
void SetState(state_pointer newstate);
|
||||
bool mode;
|
||||
Counter * bar_pressure;
|
||||
Counter * bar_speed;
|
||||
bool current_mode;
|
||||
Counter set [2] = {{0, 100}, {0, 120}};
|
||||
LiquidCrystal * _lcd;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -24,7 +24,7 @@ void Counter::dec() {
|
||||
}
|
||||
|
||||
|
||||
int Counter::getInit(){
|
||||
int Counter::getCurrent(){
|
||||
return this->init;
|
||||
}
|
||||
|
||||
|
||||
@ -7,23 +7,37 @@
|
||||
|
||||
#include <StateHandler.h>
|
||||
|
||||
StateHandler::StateHandler() {
|
||||
// TODO Auto-generated constructor stub
|
||||
|
||||
StateHandler::StateHandler(LiquidCrystal * lcd) {
|
||||
this->_lcd = lcd;
|
||||
// TODO
|
||||
}
|
||||
|
||||
StateHandler::~StateHandler() {
|
||||
// TODO Auto-generated destructor stub
|
||||
}
|
||||
|
||||
int StateHandler::getSetPresuure(){
|
||||
//TODO
|
||||
return 0;
|
||||
unsigned int StateHandler::getSetPressure(){
|
||||
return (unsigned int)this->set[PRESSURE].getCurrent();
|
||||
}
|
||||
|
||||
int StateHandler::getSetSpeed(){
|
||||
unsigned int StateHandler::getSetSpeed(){
|
||||
return (unsigned int)this->set[FAN_SPEED].getCurrent();
|
||||
}
|
||||
|
||||
void StateHandler::displaySet(unsigned int value1, unsigned int value2){
|
||||
// TODO
|
||||
return 0;
|
||||
/**
|
||||
* MANUAL MODE:
|
||||
* ----------------
|
||||
* SPEED: 20%
|
||||
* PRESSURE: XXPa
|
||||
* ----------------
|
||||
* AUTO MODE:
|
||||
* ----------------
|
||||
* PRESSURE SET: 35Pa
|
||||
* PRESSURE CUR: XXPa
|
||||
* ----------------
|
||||
*/
|
||||
}
|
||||
|
||||
void StateHandler::HandleState(const Event &event){
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user