Skip to content
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 notification support #325

Merged
merged 16 commits into from
Nov 13, 2023
Merged

Add notification support #325

merged 16 commits into from
Nov 13, 2023

Conversation

stintel
Copy link
Collaborator

@stintel stintel commented Nov 3, 2023

No description provided.

@stintel stintel force-pushed the feature/notify branch 3 times, most recently from bd9c65c to c84ea5e Compare November 7, 2023 19:08
stintel and others added 16 commits November 8, 2023 23:36
Example JSON:

{
  "cmd": "notify",
  "data": {
    "audio_url": "http://was.local/dingding.wav",
    "repeat": 10,
    "text": "Wake Up!!!"
  }
}
Reuse notify_task for it instead.
When the JSON does not contain backlight or backlight_max, cJSON_IsBool
will return false.
Strobe effect will be enabled when strobe_period_ms is added to the
notify message.
The cancel button only breaks out of the loop that calls esp_audio_play.
This only happens when ESP Audio is done playing. When playing a long
audio file, this results in the cancel button not responding.
We need to use valuedouble here as cJSON does not support 64 bit int.
We will hold the ID of the active notification. This way, if WAS sends
the same notification again, we can tell WAS the notification is already
active.
But skip this step when the notify ID is 1, which we use for
identify/locate. This command is not tracked in WAS NotifyQueue.
After changing identify/locate to use notify_task, more members where
added to the notify_data struct. Due to this, identify/locate no longer
turned on the backlight, and the volume was set to 0.
This is a bit tricky as in FreeRTOS we cannot get the task data from a
running task. Therefore, change notify_active to a pointer to struct
notify_data we pass to the notify task, and add a member cancel to
cancel the running task.

While at it, also free the task data memory at the end to not leak
memory.
@kristiankielhofner kristiankielhofner merged commit 167dcf2 into main Nov 13, 2023
15 checks passed
@kristiankielhofner kristiankielhofner deleted the feature/notify branch November 13, 2023 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants