-
Notifications
You must be signed in to change notification settings - Fork 765
feat: trigger AHT20 sampling from native touch electrode and notify active agent #84
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
base: main
Are you sure you want to change the base?
Changes from all commits
b5f804e
b98a352
a2b1181
215d42b
7d016fc
081c099
3a52e95
93221bf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -285,6 +285,22 @@ void getGyroscope(void) | |
| Gyro.z = Gyro.z * gyroScales; | ||
| } | ||
|
|
||
| esp_err_t QMI8658_Read_Temperature(float *temp_c) | ||
| { | ||
| if (!temp_c) { | ||
| return ESP_ERR_INVALID_ARG; | ||
| } | ||
|
|
||
| uint8_t buf[2] = {0}; | ||
| esp_err_t err = I2C_Read(Device_addr, QMI8658_TEMP_L, buf, 2); | ||
| if (err != ESP_OK) { | ||
| return err; | ||
| } | ||
|
|
||
| int16_t raw = (int16_t)(((uint16_t)buf[1] << 8) | buf[0]); | ||
| *temp_c = ((float)raw / 256.0f) + 25.0f; | ||
| return ESP_OK; | ||
| } | ||
|
Comment on lines
+288
to
+303
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🌐 Web query:
💡 Result: For the QMI8658 temperature registers:
Conversion formula: [ Sources: NuttX QMI8658 driver documentation (registers + scale) [1] and a QMI8658 driver doc noting the same datasheet scale [2]. [1] (mail-archive.com) Citations:
Remove the The QMI8658 datasheet specifies the temperature conversion as 🤖 Prompt for AI Agents |
||
|
|
||
|
|
||
|
|
||
|
|
||
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.
s_event_cbfires inside theesp_timertask — blocking I2C reads here will stall button debouncing.To maintain predictable and timely execution of tasks, callbacks should never attempt block (waiting for resources) or yield (give up control) operations, because such operations disrupt the serialized execution of callbacks. The chain is:
esp_timerISR →Timer_Callback→button_ticks()→Button_*_Callback→s_event_cb. Timer callbacks are dispatched from a high-priorityesp_timertask; it is recommended to only do the minimal possible amount of work from the callback itself, posting an event to a lower priority task using a queue instead.Per the PR description, the registered callback is intended to perform AHT20 I2C reads, which are blocking. Blocking inside this chain will delay subsequent 5 ms tick callbacks, corrupting debounce state and causing missed/phantom button events.
Recommended pattern: signal a FreeRTOS semaphore or queue in
s_event_cb, then perform the I2C read in a dedicated lower-priority task that waits on that signal.💡 Sketch of the non-blocking pattern (in the lick_trigger consumer)
Also applies to: 42-42, 49-49
🤖 Prompt for AI Agents