-
Notifications
You must be signed in to change notification settings - Fork 253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Chirpy support to databank #479
base: main
Are you sure you want to change the base?
Conversation
@@ -40,12 +41,99 @@ const char *pi_data[] = { | |||
|
|||
const int databank_num_pages = (sizeof(pi_data) / sizeof(char*) / 2); | |||
|
|||
typedef enum { | |||
DATABANK_DISPLAY = 0, | |||
DATABANK_CHIRPING, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The chirping mode changes the ticks to speed up etc.
} | ||
|
||
// Which byte are we currently processing? | ||
static uint16_t curr_data_ix; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the chirpy demo code we also have data length and pointer to data here. But I'm instead using just whatever the currently displayed data is.
|
||
static uint8_t _databank_get_next_byte(uint8_t *next_byte) { | ||
// We always send out the currently displayed dataset | ||
int curr_pos = databank_state.databank_page * 2 + 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll be honest I don't quite understand the pagination used into the pi_data array, but this seems to work.
break; | ||
case EVENT_LIGHT_BUTTON_UP: | ||
databank_state.current_word = (databank_state.current_word + max_words - 1) % max_words; | ||
// TODO ideally change this to chirp if both buttons are pressed at the same time? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is what I mentioned in the PR description. This shouldn't be in this section, but I'm not sure what the best practices is to trigger the chirping since all button presses are used already.
I just backed the Sensor Watch Pro campagin, so I figured I'd check out the code a bit. This PR adds Chirp support to the databank to get the data back out of the watch again.
I closely followed the chirpy demo code. More comments inline.
However: one issue remains. Since the light and alarm buttons are already used in both short press and long press I'm not sure what I should be using to trigger the chirping. One idea was simultaneous presses of the light and alarm buttons? I notice there is no specific event for this. I could probably work around that but I figured I'd ask for advice.