Added WiFi kernel drivers and refactored Wifi service#557
Conversation
As to not confuse with TactilityKernel project
Refactor to move driver to kernel
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
✅ Files skipped from review due to trivial changes (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughThis change adds WiFi driver APIs, ESP32 and POSIX WiFi drivers, and platform wiring for those drivers. Tactility’s WiFi service and app-side WiFi types are updated to use the new driver records and event shapes. The old TactilityC WiFi exports are removed, thread-local storage moves to slot 1, many include paths are updated, and disabled 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (3)
Tactility/Source/app/wificonnect/WifiConnect.cpp (1)
28-42: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRedundant
requestViewUpdate()on connection failure path.When the connection fails and
state.isConnecting()is true,requestViewUpdate()is called at line 38 inside theifblock, then again unconditionally at line 42. The second call is a no-op since nothing changed between the two calls. Consider removing the inner call or guarding the outer one.♻️ Proposed fix: remove redundant inner call
} else { if (state.isConnecting()) { state.setConnecting(false); state.setConnectionError(true); - requestViewUpdate(); } } } requestViewUpdate();TactilityKernel/include/tactility/drivers/wifi.h (1)
211-213: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDocument buffer size requirements and
num_resultssemantics.
wifi_get_scan_results,wifi_station_get_ipv4_address, andwifi_station_get_target_ssidaccept output buffers without documenting required sizes or in/out semantics.num_resultsappears to be an in/out parameter (caller sets max capacity, function sets actual count), and thechar*buffers need minimum sizes (16 for IPv4, 33 for SSID based onWifiApRecord.ssid[33]). A brief doc comment per function would prevent misuse by future consumers.📝 Suggested documentation additions
error_t wifi_get_scan_results(struct Device* device, struct WifiApRecord* results, size_t* num_results); +/** `@brief` Retrieve scan results. `@param` num_results In: max capacity of results array. Out: actual number of results written. */ error_t wifi_station_get_ipv4_address(struct Device* device, char* ipv4); +/** `@brief` Get the station's IPv4 address. `@param` ipv4 Buffer of at least 16 bytes ("255.255.255.255\0"). */ error_t wifi_station_get_target_ssid(struct Device* device, char* ssid); +/** `@brief` Get the target SSID. `@param` ssid Buffer of at least 33 bytes (32 + null terminator). */Platforms/platform-esp32/source/drivers/esp32_wifi.cpp (1)
272-274: 📐 Maintainability & Code Quality | 🔵 TrivialConsider removing null pointer guards in driver API functions.
Every
api_*function checksctx == nullptrand output parameters for null. Since these are vtable implementations called through the kernel'swifi_*wrappers, a nulldevicewould crash indevice_get_driver_databefore reaching these checks. Per the Linux kernel style adopted for internal APIs in this codebase, callers should pass valid pointers and crashes on invalid input are bugs detected during development.Based on learnings: "Adopt Linux kernel style: do not add null pointer guards in internal APIs. Assume callers pass valid pointers; crashes on invalid pointers are bugs detected during development."
Also applies to: 281-283, 290-292, 298-300, 307-309, 333-335, 353-355, 362-364, 371-373, 426-428, 444-446, 457-459, 472-474
Source: Learnings
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 84d253d1-0f9c-4c2c-9fce-92d29d02a90c
📒 Files selected for processing (100)
Buildscripts/sdkconfig/default.propertiesDevices/btt-panda-touch/bigtreetech,panda-touch.dtsDevices/cyd-2432s024c/cyd,2432s024c.dtsDevices/cyd-2432s024r/cyd,2432s024r.dtsDevices/cyd-2432s028r/cyd,2432s028r.dtsDevices/cyd-2432s028rv3/cyd,2432s028rv3.dtsDevices/cyd-2432s032c/cyd,2432s032c.dtsDevices/cyd-3248s035c/cyd,3248s035c.dtsDevices/cyd-4848s040c/cyd,4848s040c.dtsDevices/cyd-8048s043c/cyd,8048s043c.dtsDevices/cyd-e32r28t/cyd,e32r28t.dtsDevices/cyd-e32r32p/cyd,e32r32p.dtsDevices/elecrow-crowpanel-advance-28/elecrow,crowpanel-advance-28.dtsDevices/elecrow-crowpanel-advance-35/elecrow,crowpanel-advance-35.dtsDevices/elecrow-crowpanel-advance-50/elecrow,crowpanel-advance-50.dtsDevices/elecrow-crowpanel-basic-28/elecrow,crowpanel-basic-28.dtsDevices/elecrow-crowpanel-basic-35/elecrow,crowpanel-basic-35.dtsDevices/elecrow-crowpanel-basic-50/elecrow,crowpanel-basic-50.dtsDevices/generic-esp32/generic,esp32.dtsDevices/generic-esp32c6/generic,esp32c6.dtsDevices/generic-esp32s3/generic,esp32s3.dtsDevices/guition-jc2432w328c/guition,jc2432w328c.dtsDevices/guition-jc3248w535c/guition,jc3248w535c.dtsDevices/guition-jc8048w550c/guition,jc8048w550c.dtsDevices/heltec-wifi-lora-32-v3/heltec,wifi-lora-32-v3.dtsDevices/lilygo-tdeck-max/lilygo,tdeck-max.dtsDevices/lilygo-tdeck/Source/Init.cppDevices/lilygo-tdeck/lilygo,tdeck.dtsDevices/lilygo-tdisplay-s3/lilygo,tdisplay-s3.dtsDevices/lilygo-tdisplay/lilygo,tdisplay.dtsDevices/lilygo-tdongle-s3/lilygo,tdongle-s3.dtsDevices/lilygo-thmi/lilygo,thmi.dtsDevices/lilygo-tlora-pager/lilygo,tlora-pager.dtsDevices/m5stack-cardputer-adv/m5stack,cardputer-adv.dtsDevices/m5stack-cardputer/m5stack,cardputer.dtsDevices/m5stack-core2/m5stack,core2.dtsDevices/m5stack-cores3/m5stack,cores3.dtsDevices/m5stack-papers3/m5stack,papers3.dtsDevices/m5stack-stackchan/m5stack,stackchan.dtsDevices/m5stack-stickc-plus2/m5stack,stickc-plus2.dtsDevices/m5stack-sticks3/m5stack,sticks3.dtsDevices/unphone/unphone.dtsDevices/waveshare-esp32-s3-geek/waveshare,esp32-s3-geek.dtsDevices/waveshare-s3-lcd-13/waveshare,s3-lcd-13.dtsDevices/waveshare-s3-touch-lcd-128/waveshare,s3-touch-lcd-128.dtsDevices/waveshare-s3-touch-lcd-147/waveshare,s3-touch-lcd-147.dtsDevices/waveshare-s3-touch-lcd-43/waveshare,s3-touch-lcd-43.dtsDevices/wireless-tag-wt32-sc01-plus/wireless-tag,wt32-sc01-plus.dtsPlatforms/platform-esp32/CMakeLists.txtPlatforms/platform-esp32/bindings/espressif,esp32-wifi-pinned.yamlPlatforms/platform-esp32/bindings/espressif,esp32-wifi.yamlPlatforms/platform-esp32/include/tactility/bindings/esp32_wifi.hPlatforms/platform-esp32/include/tactility/bindings/esp32_wifi_pinned.hPlatforms/platform-esp32/include/tactility/drivers/esp32_wifi.hPlatforms/platform-esp32/include/tactility/drivers/esp32_wifi_pinned.hPlatforms/platform-esp32/source/drivers/esp32_wifi.cppPlatforms/platform-esp32/source/drivers/esp32_wifi_pinned.cppPlatforms/platform-esp32/source/module.cppPlatforms/platform-posix/source/drivers/mock_wifi.cppPlatforms/platform-posix/source/module.cppTactility/Include/Tactility/PanicHandler.hTactility/Include/Tactility/Platform.hTactility/Include/Tactility/SystemEvents.hTactility/Include/Tactility/Tactility.hTactility/Include/Tactility/kernel/SpiDeviceLock.hTactility/Include/Tactility/network/HttpServer.hTactility/Include/Tactility/service/wifi/Wifi.hTactility/Private/Tactility/Critical.hTactility/Private/Tactility/app/wifimanage/State.hTactility/Private/Tactility/app/wifimanage/View.hTactility/Source/Critical.cppTactility/Source/PanicHandler.cppTactility/Source/Platform.cppTactility/Source/SystemEvents.cppTactility/Source/Tactility.cppTactility/Source/app/boot/Boot.cppTactility/Source/app/crashdiagnostics/QrUrl.cppTactility/Source/app/files/State.cppTactility/Source/app/files/View.cppTactility/Source/app/fileselection/State.cppTactility/Source/app/fileselection/View.cppTactility/Source/app/screenshot/Screenshot.cppTactility/Source/app/wificonnect/WifiConnect.cppTactility/Source/app/wifimanage/View.cppTactility/Source/app/wifimanage/WifiManage.cppTactility/Source/hal/Hal.cppTactility/Source/lvgl/Statusbar.cppTactility/Source/network/Ntp.cppTactility/Source/service/wifi/Wifi.cppTactility/Source/service/wifi/WifiEsp.cppTactility/Source/service/wifi/WifiMock.cppTactility/Source/settings/time.cppTactilityC/Include/tt_wifi.hTactilityC/Source/tt_init.cppTactilityC/Source/tt_wifi.cppTactilityFreeRtos/Include/Tactility/Thread.hTactilityKernel/include/tactility/drivers/wifi.hTactilityKernel/source/concurrent/thread.cppTactilityKernel/source/drivers/wifi.cppTactilityKernel/source/kernel_symbols.c
💤 Files with no reviewable changes (6)
- Tactility/Source/service/wifi/WifiMock.cpp
- TactilityC/Include/tt_wifi.h
- Tactility/Include/Tactility/kernel/SpiDeviceLock.h
- TactilityC/Source/tt_wifi.cpp
- Tactility/Source/service/wifi/WifiEsp.cpp
- TactilityC/Source/tt_init.cpp
Summary by CodeRabbit