hardkernel / smartpower3

11 stars 6 forks source link

No obvious way to turn off and reset WiFi credentials after AP has been set #18

Closed cedel1 closed 1 year ago

cedel1 commented 1 year ago

Maybe I am just blind, but there seems to be no way to turn off/reset WiFi after successful connection to Access Point.

While it does not hinder the use of SmartPower, it is unfortunate to forever store your network settings in a device that can be easily moved (security concerns) and have it to always connect to your network even when the function is absolutely not required.

Firmware date: 22/02/2022

Steps to reproduce:

  1. Connect to SmartPower3 via serial (Putty, Minicom does not seem to work).
  2. Enter WiFi command mode as per manual, by pressing Ctrl-C.
  3. Select point "3. Scan & Connection AP".
  4. Select your WiFi.
  5. Enter WiFi password.
  6. SmartPower connects to the WiFi set.
  7. Now I do not see any obvious way to disconnect from the WiFi network, because:

a. there is no disconnect setting visible b. there is no way to reset network/AP details - setting a wrong password or different network AP does not work, because after all the connection tries have been made, SmartPower cnnects to the network using the previous credentials (ie. AP/network credentials are probably changed only after successful connection to new network) c. SmartPower remembers WiFi settings during powerdown/over reboot

Expected behavior:

  1. There is a setting on the settings page (and maybe also in the serial WiFi Command mode), something like "WiFi On/Off"
  2. WiFi Command mode contains a setting to reset/forget the AP and network credentials. I see two options here - either a menu item "Forget all network settings" or the "Scan & Connection AP" subselection could always contain, as first item, selection to "forget" AP and network settings.
bablokb commented 1 year ago

In fact my SP3 forgets the AP and network settings after a while. No idea why and not reproducible.

cedel1 commented 1 year ago

In fact my SP3 forgets the AP and network settings after a while. No idea why and not reproducible.

Checked just now and my SP3 remembers the settings at least since I started the issue.

bablokb commented 1 year ago

Yes, I have found no pattern about this issue. SP3 keeps settings for weeks and then suddenly they are lost. Have you thought about implementing your idea yourself? The process for creating a new firmware is well documented and easy to follow. And adding a new option to the serial setup-interface should be no big deal.

cedel1 commented 1 year ago

Have you thought about implementing your idea yourself?

I thought about it - but i have little experience with embedded development and C++. So far I managed to have a look at the code and it seems doable at my skill level. So give me some time and I'll try to get dev environment working and see what I can come up with.

tomek-szczesny commented 1 year ago

I've never done anything in this environment nor know C or C++ above basic level, and I managed to implement measurement filters in this device. I encourage you to try, and let us know if you need help.

cedel1 commented 1 year ago

OK, made a pull request #19 , ready for review.

Sorry it took so long, I spent almost a day figuring out a combination of library versions to compile (even master) without problems and upload to device so I could test it.

Tested on my SP3, seems to work nicely.

Actually, during the testing, I found out at least one more questionable/problematic behavior in the WiFi command menu that I'd like to look into - but that would be an item for another issue/PR.

tomek-szczesny commented 1 year ago

You are awesome. Thanks for this contribution. I'll see if I can help at least persuading Lee to accept these PRs if he won't notice himself in coming days.

cedel1 commented 1 year ago

@tomek-szczesny Thank you, You are welcome:) I'd really be happy if somebody made a review of the PR, just to be sure (even though it seems it works for me).

Otherwise, no need to hurry - as I wrote above, there's another issue I am looking into. Even though it would help to know team's ideas about the current PR so I can adjust.

tomek-szczesny commented 1 year ago

I looked through your comments on your own PR and everything looked fine to me, although I'm not the one who makes decisions around here. If my lousy code was accepted then I'm sure yours will be too.

I think the least I can do is to test your solution, but I don't have the environment set up at this time. Do you think you could roll out the binary on your fork or something?

cedel1 commented 1 year ago

I think the least I can do is to test your solution

That would be nice of you, thank you!

Do you think you could roll out the binary on your fork or something?

I'd like to, but I am not sure how to do that - I used tasks/make targets from IDE to build and download into SP3. Do you have any idea how to do that properly (or where to look for a good answer)? If not or you would have to search yourself, I'll try to find a solution, but it might take some time.

tomek-szczesny commented 1 year ago

No idea unfortunately - never done that either. If you find that too troublesome I'll just set up the environment on my side. Don't spend more than 1h on it. :)

cedel1 commented 1 year ago

Ouch, I discovered major problem I didn't notice before, so back to draft... :(

Somehow, I forgot to check the main function of SP3 - supplying power, which does not work (can be seen on the screen). On the other hand, the same happens when I build and upload master branch - the result is the same. So my hopes are it's a problem with some library or the whole process.

cedel1 commented 1 year ago

In the end I asked for help on Hardkernel forum (https://forum.odroid.com/viewtopic.php?f=86&t=46505&sid=975fa3e85bab30cb192cdd4921863e78) - if we manage to resolve the problem, this and https://github.com/hardkernel/smartpower3/issues/10 might be resolved.

tomek-szczesny commented 1 year ago

Yeah I saw your request on the forum, unfortunately I can't help you with that. Hopefully the guy behind the original firmware will respond soon.

bablokb commented 1 year ago

I'd like to, but I am not sure how to do that

You go to "Releases" on the right side and add a new release. Here you can upload binaries for the release.

cedel1 commented 1 year ago

@bablokb Thank you very much for the info. It will become handy once the more general firmware issue is solved.

cedel1 commented 1 year ago

OK, since the solution to #10 was found and has no relation to this PR (and I've tested this PR with the fix and it works), I am marking this as ready for review.

cedel1 commented 1 year ago

Fixed in release 2.0 (https://wiki.odroid.com/accessory/power_supply_battery/smartpower3#apr03_v20).