menu: [#25] handle eventpair with rotary
This commit is contained in:
parent
01855e2f52
commit
83de15ce5b
@ -8,8 +8,8 @@
|
|||||||
#include "Manager.h"
|
#include "Manager.h"
|
||||||
#include "ThreadCommon.h"
|
#include "ThreadCommon.h"
|
||||||
|
|
||||||
Manager::Manager(ThreadCommon::QueueManager* qm)
|
Manager::Manager(ThreadCommon::QueueManager* qm, Menu * menu)
|
||||||
: _qm(qm), set_point(0, 100, 5)
|
: _qm(qm), _menu(menu), set_point(0, 100, 5)
|
||||||
{
|
{
|
||||||
set_point.setCurrent(0);
|
set_point.setCurrent(0);
|
||||||
}
|
}
|
||||||
@ -43,11 +43,13 @@ void Manager::taskFunction()
|
|||||||
{
|
{
|
||||||
_qm->receive<Event>(ThreadCommon::QueueManager::manager_event_master, &data, portMAX_DELAY);
|
_qm->receive<Event>(ThreadCommon::QueueManager::manager_event_master, &data, portMAX_DELAY);
|
||||||
event_pair= this->parseEvent(&data);
|
event_pair= this->parseEvent(&data);
|
||||||
|
_menu->HandleEventPair(&event_pair);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void thread_manager(void* pvParams)
|
void thread_manager(void* pvParams)
|
||||||
{
|
{
|
||||||
Manager m(static_cast<ThreadCommon::QueueManager*>(pvParams));
|
Menu menu;
|
||||||
|
Manager m(static_cast<ThreadCommon::QueueManager*>(pvParams), &menu);
|
||||||
m.taskFunction();
|
m.taskFunction();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,11 +11,12 @@
|
|||||||
#include "ThreadCommon.h"
|
#include "ThreadCommon.h"
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
#include "Counter.h"
|
#include "Counter.h"
|
||||||
|
#include "Menu.h"
|
||||||
|
|
||||||
|
|
||||||
class Manager {
|
class Manager {
|
||||||
public:
|
public:
|
||||||
Manager(ThreadCommon::QueueManager* qm);
|
Manager(ThreadCommon::QueueManager* qm, Menu * menu);
|
||||||
virtual ~Manager();
|
virtual ~Manager();
|
||||||
void taskFunction();
|
void taskFunction();
|
||||||
private:
|
private:
|
||||||
|
|||||||
@ -20,6 +20,40 @@ Menu::~Menu()
|
|||||||
|
|
||||||
void Menu::HandleEventPair (Event::EventPair *ep)
|
void Menu::HandleEventPair (Event::EventPair *ep)
|
||||||
{
|
{
|
||||||
|
switch(ep->et/*EventType*/)
|
||||||
|
{
|
||||||
|
case Event::Rotary:
|
||||||
|
// can be wrapped in a function, but this was found to be more clear solution,
|
||||||
|
// since we are still handling eventpair here, although nested
|
||||||
|
switch(static_cast<ThreadCommon::RotaryAction>(ep->rd)/*RawData*/)
|
||||||
|
{
|
||||||
|
case ThreadCommon::RotaryAction::Right:
|
||||||
|
this->HandleObj(MenuObjEvent::eRollClockWise);
|
||||||
|
break;
|
||||||
|
case ThreadCommon::RotaryAction::Left:
|
||||||
|
this->HandleObj(MenuObjEvent::eRollCClockWise);
|
||||||
|
break;
|
||||||
|
case ThreadCommon::RotaryAction::Press:
|
||||||
|
this->HandleObj(MenuObjEvent::eClick);
|
||||||
|
break;
|
||||||
|
case ThreadCommon::RotaryAction::Idle:
|
||||||
|
/*I guess this is left for debugging purposes ;D*/
|
||||||
|
break;
|
||||||
|
case default:
|
||||||
|
/* Pretty damn bad code if reached here */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Event::InternalTemp:
|
||||||
|
// TODO
|
||||||
|
break;
|
||||||
|
case Event::ExternalTemp:
|
||||||
|
// TODO
|
||||||
|
break;
|
||||||
|
case default:
|
||||||
|
/* Manager has big issues... */
|
||||||
|
break;
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user