Merge pull request #99 from voloved/activity_moon_loop_backwards
Activity and moon can loop backwards
This commit is contained in:
commit
32b44da23b
@ -184,10 +184,19 @@ bool moon_phase_face_loop(movement_event_t event, void *context) {
|
|||||||
state->offset += 86400;
|
state->offset += 86400;
|
||||||
_update(state, state->offset);
|
_update(state, state->offset);
|
||||||
break;
|
break;
|
||||||
case EVENT_ALARM_LONG_PRESS:
|
case EVENT_ALARM_LONG_PRESS:
|
||||||
state->offset = 0;
|
state->offset = 0;
|
||||||
_update(state, state->offset);
|
_update(state, state->offset);
|
||||||
break;
|
break;
|
||||||
|
case EVENT_LIGHT_BUTTON_DOWN:
|
||||||
|
break;
|
||||||
|
case EVENT_LIGHT_BUTTON_UP:
|
||||||
|
state->offset -= 86400;
|
||||||
|
_update(state, state->offset);
|
||||||
|
break;
|
||||||
|
case EVENT_LIGHT_LONG_PRESS:
|
||||||
|
movement_illuminate_led();
|
||||||
|
break;
|
||||||
case EVENT_TIMEOUT:
|
case EVENT_TIMEOUT:
|
||||||
// QUESTION: Should timeout reset offset to 0?
|
// QUESTION: Should timeout reset offset to 0?
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -47,6 +47,9 @@
|
|||||||
* each button press, and both the text and the graphical representation will
|
* each button press, and both the text and the graphical representation will
|
||||||
* display the moon phase for that day. Try pressing the Alarm button 27 times
|
* display the moon phase for that day. Try pressing the Alarm button 27 times
|
||||||
* now, just to visualize what the moon will look like over the next month.
|
* now, just to visualize what the moon will look like over the next month.
|
||||||
|
* Pressing the Light button will move back in time.
|
||||||
|
*
|
||||||
|
* Holding the Light button will illuminate the display.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "movement.h"
|
#include "movement.h"
|
||||||
|
|||||||
@ -86,6 +86,13 @@ void activity_logging_face_activate(void *context) {
|
|||||||
bool activity_logging_face_loop(movement_event_t event, void *context) {
|
bool activity_logging_face_loop(movement_event_t event, void *context) {
|
||||||
activity_logging_state_t *state = (activity_logging_state_t *)context;
|
activity_logging_state_t *state = (activity_logging_state_t *)context;
|
||||||
switch (event.event_type) {
|
switch (event.event_type) {
|
||||||
|
case EVENT_LIGHT_LONG_PRESS:
|
||||||
|
movement_illuminate_led();
|
||||||
|
break;
|
||||||
|
case EVENT_LIGHT_BUTTON_DOWN:
|
||||||
|
state->display_index = (state->display_index + ACTIVITY_LOGGING_NUM_DAYS - 1) % ACTIVITY_LOGGING_NUM_DAYS;
|
||||||
|
_activity_logging_face_update_display(state);
|
||||||
|
break;
|
||||||
case EVENT_ALARM_BUTTON_DOWN:
|
case EVENT_ALARM_BUTTON_DOWN:
|
||||||
state->display_index = (state->display_index + 1) % ACTIVITY_LOGGING_NUM_DAYS;
|
state->display_index = (state->display_index + 1) % ACTIVITY_LOGGING_NUM_DAYS;
|
||||||
// fall through
|
// fall through
|
||||||
|
|||||||
@ -40,6 +40,8 @@
|
|||||||
*
|
*
|
||||||
* A short press of the Alarm button moves backwards in the data log, showing yesterday's active minutes,
|
* A short press of the Alarm button moves backwards in the data log, showing yesterday's active minutes,
|
||||||
* then the day before, etc. going back 14 days.
|
* then the day before, etc. going back 14 days.
|
||||||
|
* A short press of the Light button moves forward in the data log, looping around if we're on the most-recent day.
|
||||||
|
* Holding the Light button will illuminate the display.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user