Skip to content

Added WiFi kernel drivers and refactored Wifi service#557

Merged
KenVanHoeylandt merged 4 commits into
mainfrom
develop
Jul 9, 2026
Merged

Added WiFi kernel drivers and refactored Wifi service#557
KenVanHoeylandt merged 4 commits into
mainfrom
develop

Conversation

@KenVanHoeylandt

@KenVanHoeylandt KenVanHoeylandt commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features
    • Added support for a pinned ESP32 Wi‑Fi driver and updated board definitions to consistently expose Wi‑Fi capability.
    • Improved the POSIX Wi‑Fi simulator with deterministic scan and connection behavior for testing.
  • Bug Fixes
    • Refined Wi‑Fi event handling and connection-state updates for more reliable scanning and connect/disconnect flows.
  • Breaking Changes
    • Removed the legacy C Wi‑Fi API; Wi‑Fi control must use the updated interfaces.

As to not confuse with TactilityKernel project
Refactor to move driver to kernel
@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b9e00b43-622b-4637-b969-3be3ec1cc50c

📥 Commits

Reviewing files that changed from the base of the PR and between f5e18c0 and 887b906.

📒 Files selected for processing (6)
  • Devices/cyd-2432s032c/Source/Configuration.cpp
  • Devices/lilygo-tdisplay-s3/Source/Init.cpp
  • Devices/lilygo-thmi/Source/Init.cpp
  • Devices/lilygo-tlora-pager/Source/Init.cpp
  • Platforms/platform-esp32/source/drivers/esp32_wifi_pinned.cpp
  • Tactility/Source/service/wifi/Wifi.cpp
✅ Files skipped from review due to trivial changes (2)
  • Devices/lilygo-tdisplay-s3/Source/Init.cpp
  • Devices/lilygo-thmi/Source/Init.cpp
🚧 Files skipped from review as they are similar to previous changes (2)
  • Platforms/platform-esp32/source/drivers/esp32_wifi_pinned.cpp
  • Tactility/Source/service/wifi/Wifi.cpp

📝 Walkthrough

Walkthrough

This 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 wifi0 nodes are added to device trees across supported boards.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 17.05% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: new WiFi kernel drivers and a refactored WiFi service.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch develop

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Nitpick comments (3)
Tactility/Source/app/wificonnect/WifiConnect.cpp (1)

28-42: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Redundant requestViewUpdate() on connection failure path.

When the connection fails and state.isConnecting() is true, requestViewUpdate() is called at line 38 inside the if block, 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 win

Document buffer size requirements and num_results semantics.

wifi_get_scan_results, wifi_station_get_ipv4_address, and wifi_station_get_target_ssid accept output buffers without documenting required sizes or in/out semantics. num_results appears to be an in/out parameter (caller sets max capacity, function sets actual count), and the char* buffers need minimum sizes (16 for IPv4, 33 for SSID based on WifiApRecord.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 | 🔵 Trivial

Consider removing null pointer guards in driver API functions.

Every api_* function checks ctx == nullptr and output parameters for null. Since these are vtable implementations called through the kernel's wifi_* wrappers, a null device would crash in device_get_driver_data before 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

📥 Commits

Reviewing files that changed from the base of the PR and between dbb96a8 and b7b64a9.

📒 Files selected for processing (100)
  • Buildscripts/sdkconfig/default.properties
  • Devices/btt-panda-touch/bigtreetech,panda-touch.dts
  • Devices/cyd-2432s024c/cyd,2432s024c.dts
  • Devices/cyd-2432s024r/cyd,2432s024r.dts
  • Devices/cyd-2432s028r/cyd,2432s028r.dts
  • Devices/cyd-2432s028rv3/cyd,2432s028rv3.dts
  • Devices/cyd-2432s032c/cyd,2432s032c.dts
  • Devices/cyd-3248s035c/cyd,3248s035c.dts
  • Devices/cyd-4848s040c/cyd,4848s040c.dts
  • Devices/cyd-8048s043c/cyd,8048s043c.dts
  • Devices/cyd-e32r28t/cyd,e32r28t.dts
  • Devices/cyd-e32r32p/cyd,e32r32p.dts
  • Devices/elecrow-crowpanel-advance-28/elecrow,crowpanel-advance-28.dts
  • Devices/elecrow-crowpanel-advance-35/elecrow,crowpanel-advance-35.dts
  • Devices/elecrow-crowpanel-advance-50/elecrow,crowpanel-advance-50.dts
  • Devices/elecrow-crowpanel-basic-28/elecrow,crowpanel-basic-28.dts
  • Devices/elecrow-crowpanel-basic-35/elecrow,crowpanel-basic-35.dts
  • Devices/elecrow-crowpanel-basic-50/elecrow,crowpanel-basic-50.dts
  • Devices/generic-esp32/generic,esp32.dts
  • Devices/generic-esp32c6/generic,esp32c6.dts
  • Devices/generic-esp32s3/generic,esp32s3.dts
  • Devices/guition-jc2432w328c/guition,jc2432w328c.dts
  • Devices/guition-jc3248w535c/guition,jc3248w535c.dts
  • Devices/guition-jc8048w550c/guition,jc8048w550c.dts
  • Devices/heltec-wifi-lora-32-v3/heltec,wifi-lora-32-v3.dts
  • Devices/lilygo-tdeck-max/lilygo,tdeck-max.dts
  • Devices/lilygo-tdeck/Source/Init.cpp
  • Devices/lilygo-tdeck/lilygo,tdeck.dts
  • Devices/lilygo-tdisplay-s3/lilygo,tdisplay-s3.dts
  • Devices/lilygo-tdisplay/lilygo,tdisplay.dts
  • Devices/lilygo-tdongle-s3/lilygo,tdongle-s3.dts
  • Devices/lilygo-thmi/lilygo,thmi.dts
  • Devices/lilygo-tlora-pager/lilygo,tlora-pager.dts
  • Devices/m5stack-cardputer-adv/m5stack,cardputer-adv.dts
  • Devices/m5stack-cardputer/m5stack,cardputer.dts
  • Devices/m5stack-core2/m5stack,core2.dts
  • Devices/m5stack-cores3/m5stack,cores3.dts
  • Devices/m5stack-papers3/m5stack,papers3.dts
  • Devices/m5stack-stackchan/m5stack,stackchan.dts
  • Devices/m5stack-stickc-plus2/m5stack,stickc-plus2.dts
  • Devices/m5stack-sticks3/m5stack,sticks3.dts
  • Devices/unphone/unphone.dts
  • Devices/waveshare-esp32-s3-geek/waveshare,esp32-s3-geek.dts
  • Devices/waveshare-s3-lcd-13/waveshare,s3-lcd-13.dts
  • Devices/waveshare-s3-touch-lcd-128/waveshare,s3-touch-lcd-128.dts
  • Devices/waveshare-s3-touch-lcd-147/waveshare,s3-touch-lcd-147.dts
  • Devices/waveshare-s3-touch-lcd-43/waveshare,s3-touch-lcd-43.dts
  • Devices/wireless-tag-wt32-sc01-plus/wireless-tag,wt32-sc01-plus.dts
  • Platforms/platform-esp32/CMakeLists.txt
  • Platforms/platform-esp32/bindings/espressif,esp32-wifi-pinned.yaml
  • Platforms/platform-esp32/bindings/espressif,esp32-wifi.yaml
  • Platforms/platform-esp32/include/tactility/bindings/esp32_wifi.h
  • Platforms/platform-esp32/include/tactility/bindings/esp32_wifi_pinned.h
  • Platforms/platform-esp32/include/tactility/drivers/esp32_wifi.h
  • Platforms/platform-esp32/include/tactility/drivers/esp32_wifi_pinned.h
  • Platforms/platform-esp32/source/drivers/esp32_wifi.cpp
  • Platforms/platform-esp32/source/drivers/esp32_wifi_pinned.cpp
  • Platforms/platform-esp32/source/module.cpp
  • Platforms/platform-posix/source/drivers/mock_wifi.cpp
  • Platforms/platform-posix/source/module.cpp
  • Tactility/Include/Tactility/PanicHandler.h
  • Tactility/Include/Tactility/Platform.h
  • Tactility/Include/Tactility/SystemEvents.h
  • Tactility/Include/Tactility/Tactility.h
  • Tactility/Include/Tactility/kernel/SpiDeviceLock.h
  • Tactility/Include/Tactility/network/HttpServer.h
  • Tactility/Include/Tactility/service/wifi/Wifi.h
  • Tactility/Private/Tactility/Critical.h
  • Tactility/Private/Tactility/app/wifimanage/State.h
  • Tactility/Private/Tactility/app/wifimanage/View.h
  • Tactility/Source/Critical.cpp
  • Tactility/Source/PanicHandler.cpp
  • Tactility/Source/Platform.cpp
  • Tactility/Source/SystemEvents.cpp
  • Tactility/Source/Tactility.cpp
  • Tactility/Source/app/boot/Boot.cpp
  • Tactility/Source/app/crashdiagnostics/QrUrl.cpp
  • Tactility/Source/app/files/State.cpp
  • Tactility/Source/app/files/View.cpp
  • Tactility/Source/app/fileselection/State.cpp
  • Tactility/Source/app/fileselection/View.cpp
  • Tactility/Source/app/screenshot/Screenshot.cpp
  • Tactility/Source/app/wificonnect/WifiConnect.cpp
  • Tactility/Source/app/wifimanage/View.cpp
  • Tactility/Source/app/wifimanage/WifiManage.cpp
  • Tactility/Source/hal/Hal.cpp
  • Tactility/Source/lvgl/Statusbar.cpp
  • Tactility/Source/network/Ntp.cpp
  • Tactility/Source/service/wifi/Wifi.cpp
  • Tactility/Source/service/wifi/WifiEsp.cpp
  • Tactility/Source/service/wifi/WifiMock.cpp
  • Tactility/Source/settings/time.cpp
  • TactilityC/Include/tt_wifi.h
  • TactilityC/Source/tt_init.cpp
  • TactilityC/Source/tt_wifi.cpp
  • TactilityFreeRtos/Include/Tactility/Thread.h
  • TactilityKernel/include/tactility/drivers/wifi.h
  • TactilityKernel/source/concurrent/thread.cpp
  • TactilityKernel/source/drivers/wifi.cpp
  • TactilityKernel/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

Comment thread Platforms/platform-esp32/source/drivers/esp32_wifi_pinned.cpp Outdated
Comment thread Tactility/Source/service/wifi/Wifi.cpp
Comment thread Tactility/Source/service/wifi/Wifi.cpp
Comment thread Tactility/Source/service/wifi/Wifi.cpp
@KenVanHoeylandt KenVanHoeylandt merged commit 1c2806b into main Jul 9, 2026
57 checks passed
@KenVanHoeylandt KenVanHoeylandt deleted the develop branch July 9, 2026 19:03
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.

1 participant