Skip to content
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

Reconfigure WiFi / Pool address / Wallet #40

Open
ffrediani opened this issue May 4, 2024 · 9 comments
Open

Reconfigure WiFi / Pool address / Wallet #40

ffrediani opened this issue May 4, 2024 · 9 comments
Labels
question Further information is requested

Comments

@ffrediani
Copy link

As after the first configuration and reboot the web interface stops responding it is useful sometimes to be able to reconfigure the board to connect to another Wifi network, another pool or change the wallet address. It is understandable the web server may use valuable resources that can impact on the hashrate. A few ways I see this can be achieve are:

1 - If simply leaving the web server enabled doesn't use any extra CPU resources when there is no opened connections it can be left with a simple form page that doesn't use CPU resources (like to show updated hashrate or other details) and through the web interface be able to change these details, save and reboot.

2 - If that is not possible, than through the pressing of the flash/boot bottom stop the mining job and start the web server. In order to give feedback to the user blink the ESP light in a certain sequence to confirm the change, and keep blinking in a different way to show that it is not mining and waiting with the web server running.

3 - If the board is taken to another place where the SSID previously configured cannot connect, the ESP notice that after some time, configure itself in AP mode and start the web server for a new configuration.

4 - If none of the above is worth implementing, simply if the flash/boot button is pressed for a few seconds while it is running (not before power on) the ESP resets its configuration and reboot in the default firmware configuration. In the case of ESP8266 Devkit can't the flash/boot button be used for this as well ?

@matteocrippa
Copy link
Owner

  1. Sadly will involve to have the web server running and will kill the already poor hash rate
  2. On devices with 2 buttons, is enough pressing to For ESP32: Unplug the USB cable, press and hold the BOOT button, and then plug in the USB cable. and this will force the setup again
  3. This should be in place too, if WiFi does not connect it reset the AP and the setup system
  4. Yes, it's what we are doing https://github.com/matteocrippa/leafminer?tab=readme-ov-file#resetting-setup

@ffrediani
Copy link
Author

Hi Mateo
ESP8266-NodeMCU Devkit has 2 buttons where the flash/boot one can may be used too to avoid the need to re-flash.
Great about point 3 then.

For 4 not sure I understood correctly. What is said on the URL is that ESP8266 has a limitation (for when there is only a single button). Where there are 2 is it already something possible or needs implementation ? The idea is to when pressing it for a few seconds while it is running it resets its current configuration to factory and reboots. I need to test, but I understand that if pressing the flash button before power on the device will not boot and will instead go into a state where it awaits a new flash, or am I confused ?

@matteocrippa
Copy link
Owner

You can see it here

force_ap = button_setup();

Basically I check if the button is pressed on start and if so I force the Access Point once again.
For now for esp8266 there's no other way to wipe it

@ffrediani
Copy link
Author

Thanks Mateo
Would it perhaps be a option for 8266 when the button is pressed to stop the mining job and bring up the Access Point for reconfiguration ?

@matteocrippa
Copy link
Owner

I recall the single button on esp8266 it's sadly not scriptable because it's just force the reboot

@ffrediani
Copy link
Author

ffrediani commented May 4, 2024

Hi Mateo
Not sure we are talking the same board, but at least on the NodeMCU one there are 2 buttons, where one is the RST one that does exactlly what you said, but there is another one called Flash which is connected to GPIO 0 (or D3) that perhaps can be used after boot. See the picture below:

image

@matteocrippa
Copy link
Owner

Ah ok, so we can add its GPIO and handle that.
I'm actually using some Weimos D1, and those have just a single RST button

@matteocrippa matteocrippa added the question Further information is requested label May 6, 2024
@matteocrippa
Copy link
Owner

@ffrediani do you know by any chance the GPIO for that button?

@ffrediani
Copy link
Author

Hello @matteocrippa
It is connected to GPIO 0 (or D3)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants