menu: [#25] handle eventpair with rotary
This commit is contained in:
parent
01855e2f52
commit
83de15ce5b
@ -8,8 +8,8 @@
|
||||
#include "Manager.h"
|
||||
#include "ThreadCommon.h"
|
||||
|
||||
Manager::Manager(ThreadCommon::QueueManager* qm)
|
||||
: _qm(qm), set_point(0, 100, 5)
|
||||
Manager::Manager(ThreadCommon::QueueManager* qm, Menu * menu)
|
||||
: _qm(qm), _menu(menu), set_point(0, 100, 5)
|
||||
{
|
||||
set_point.setCurrent(0);
|
||||
}
|
||||
@ -43,11 +43,13 @@ void Manager::taskFunction()
|
||||
{
|
||||
_qm->receive<Event>(ThreadCommon::QueueManager::manager_event_master, &data, portMAX_DELAY);
|
||||
event_pair= this->parseEvent(&data);
|
||||
_menu->HandleEventPair(&event_pair);
|
||||
}
|
||||
}
|
||||
|
||||
void thread_manager(void* pvParams)
|
||||
{
|
||||
Manager m(static_cast<ThreadCommon::QueueManager*>(pvParams));
|
||||
Menu menu;
|
||||
Manager m(static_cast<ThreadCommon::QueueManager*>(pvParams), &menu);
|
||||
m.taskFunction();
|
||||
}
|
||||
@ -11,11 +11,12 @@
|
||||
#include "ThreadCommon.h"
|
||||
#include "Event.h"
|
||||
#include "Counter.h"
|
||||
#include "Menu.h"
|
||||
|
||||
|
||||
class Manager {
|
||||
public:
|
||||
Manager(ThreadCommon::QueueManager* qm);
|
||||
Manager(ThreadCommon::QueueManager* qm, Menu * menu);
|
||||
virtual ~Manager();
|
||||
void taskFunction();
|
||||
private:
|
||||
|
||||
@ -20,6 +20,40 @@ Menu::~Menu()
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user