Skip to content

BLE: add setting and basic write protection#2204

Open
serl wants to merge 2 commits intoRalim:devfrom
serl:ble-write-protec
Open

BLE: add setting and basic write protection#2204
serl wants to merge 2 commits intoRalim:devfrom
serl:ble-write-protec

Conversation

@serl
Copy link

@serl serl commented Mar 10, 2026

  • Please check if the PR fulfills these requirements
  • The changes have been tested locally
  • There are no breaking changes
  • What kind of change does this PR introduce?

Read-only ble mode for Pinecil v2. Fixes #2203.

  • What is the current behavior?

Currently, if Bluetooth is activated, clients can change all settings and temperature.

  • What is the new behavior (if this is a feature change)?

With read-only, clients trying any write action will receive an error.

  • Other information:

Disclaimer: this has been done mostly by Claude Opus 4.6. That said, being a developer myself (sadly not C++), I reviewed the code and it looks ok. I deployed it on my Pinecil and it smells ok as well.

Also, poking around I found another possibly interesting change. Currently, if bluetooth is enabled, in order to disable it one should change it in settings, exit the menus, then unplug and replug the iron, which is not really "intuitive" (one would think that as most settings this would apply immediately).

@Ralim
Copy link
Owner

Ralim commented Mar 14, 2026

The changes seem sane to me 😄

Currently, if bluetooth is enabled, in order to disable it one should change it in settings, exit the menus, then unplug and replug the iron, which is not really "intuitive" (one would think that as most settings this would apply immediately).

This is correct, we should probably issue a reset if this setting is changed, since we dont have a known-good-and-safe way to reset the BLE stack correctly.

Happy if you want to throw that in this pr.

Any chance you can run the re-build for the docs to update them (or manually patch, your call) as its the only CI that's unhappy.

@serl serl changed the title Add setting and basic write protection BLE: add setting and basic write protection Mar 14, 2026
@serl
Copy link
Author

serl commented Mar 14, 2026

Thanks for the heads up about the CI, that should be fixed now.

I also added an extra commit to reboot the iron when bluetooth is toggled.

I tripped on the "hold the - button to exit the settings", since that looks like it was entering flash mode 🙃. So now everything should be good, but there's still an issue: when toggling BLE, the iron restarts when exiting the settings AND again 10 seconds later 🤷

@serl
Copy link
Author

serl commented Mar 14, 2026

After a little too much fiddling with Claude, I tried the most basic thing: have a button just call reboot(). It does the same: it reboots immediately AND again 10 seconds later, so it's unrelated with this BLE thing

@serl
Copy link
Author

serl commented Mar 15, 2026

Tried a number of things, the double reboot problem seems to depend on the power supply:

  • 5v -> no problem (and no soldering of course)
  • Samsung EP-TA800 (negotiates 10v, maxes out at 25W, lower than the recommended) -> double reboot
  • Apple A2743 (negotiates 20v, 70W max) -> no problem

Also, with Claude we tried a number of things, nothing worked. This is the last one just in case (not working, of course):

void reboot() {
  WDT_Disable();
  hal_por_reset();
}

In short, looks like a power supply against recommendations does not work properly, which is mildly surprising (a little bit still, since the recommendations are about soldering, not rebooting 🤷).

WDYT?

@Ralim
Copy link
Owner

Ralim commented Mar 16, 2026

Ahhh, most likely your using a power supply that uses PPS or EPS.

For these supplies you need to keep sending a keep-alive packet to keep the power on. If that stops, after a timeout it will reboot you back to 5V (and then you can negotiate up again).

You wont reallllly be able to get around the double reboot on those supplies, since we dont have a good means to keep the state of the PD stack over restarts.

I wouldn't bother turning off the WDT or anything, just do a reboot and if we double reboot so-be-it. imho :)

@serl serl force-pushed the ble-write-protec branch from 94090b2 to 97ea25a Compare March 16, 2026 11:09
@serl
Copy link
Author

serl commented Mar 16, 2026

just do a reboot and if we double reboot so-be-it. imho :)

I agree. PR updated to fix CI failures 🚀

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.

Read-only Bluetooth mode

2 participants