nerdshop / asinello-client

Client software of the asinello project
Apache License 2.0
1 stars 0 forks source link

Physical user interface software architecture #9

Open Oderik opened 3 years ago

Oderik commented 3 years ago

We need a concept and / or template implementation to abstract the physical user interface (= PUI, consisting of the LED ring, the rotary encoder and it's button).

I would prefer swappable PUI mode objects. A mode defines

The light configuration participates in the main loop to allow animations.

One mode is active at a time. Game events and user interactions eventualy swap the currently active mode.

PS: Not sure right now if the optional buzzer should be included here. I guess not because it's rather event driven.

Oderik commented 3 years ago

I'm sill struggling with C++ basics here. Some advice by someone with more experience would be helpful!

Oderik commented 3 years ago

Progress

For demonstration I implemented two modes so far:

Encoder Position

Basically the old code that lights up one LED at a time depending on the rotary encoder's value.

Transitions to Brightness mode on longpress.

Brightness

Lights up all LEDs allowing to adjust their brightness using the rotary encoder.

Stores brightness and returns to Encoder Position mode on press.

To do

The code is still very messy and could use more convenience features like activation and deactivation hooks.