OpenShock / Firmware

Espressif Firmware for OpenShock, Controlling shock collars via Reverse engineered proprietary Sub-1 GHz Protocols.
GNU Affero General Public License v3.0
31 stars 11 forks source link

[Bug] Board crashes when loading captive portal #80

Closed redmushie closed 11 months ago

redmushie commented 11 months ago

Pre-submission checklist

Board

Pishock 2023

Firmware version

1.0.0-rc.2

Flashing method

I used esptool write_flash 0x0 <image>

Describe what happened as precisely as possible.

When connecting to the captive wifi network and trying to load the captive portal, the board crashes, and the page doesn't finish loading:

After 1 attempt: Screenshot_2023-10-31-07-49-54-66_3aea4af51f236e4932235fdada7d1643

Then, reconnecting to the wifi network (since it crashed), trying to load it again: Screenshot_2023-10-31-07-51-14-51_3aea4af51f236e4932235fdada7d1643

The board crashes again.

Serial monitor logs:

image

Describe what you expected to happen instead.

Captive portal should load without the board crashing and the wifi connection dropping as a result.

In as much detail as possible, describe the exact steps you took to make the problem appear.

  1. Connect to OpenShock wifi network
  2. Visit http://10.10.10.10/
  3. (The board crashes while the page is loading)

Other remarks

No response

LucHeart commented 11 months ago

Caused by the icon font being too large, CI seems to not strip the icon font used. Works with local build cause the stripping works there.

redmushie commented 11 months ago

Interesting. I could probably fix this myself then.

hhvrc commented 11 months ago

@LucHeart @redmushie This should be fixed with the latest PR merge

redmushie commented 11 months ago

@hhvrc Bet, I'll test it right now

redmushie commented 11 months ago

Nope, still happens :(

image

image

LucHeart commented 11 months ago

can easily verify by looking at build artifacts, captive portal, icon font should not be 130kb

LucHeart commented 11 months ago

*150Kb even

image

redmushie commented 11 months ago

@LucHeart That doesn't hold up -- the captive-portal artifact is produced by the build-captive-portal CI step, which is prior to the optimization done by the build-filesystem step.

redmushie commented 11 months ago

Did a quick test:

image

I don't think the font is the issue. (This gets gzipped after, too!)

redmushie commented 11 months ago

I think it's most likely a js file that's largest.

Some more logging statements: image

Regardless, is [a large file] really the problem that we need to fix? There should be plenty other ways to approach this problem.

hhvrc commented 11 months ago

@LucHeart @redmushie This is tested to be a issue due to voltage drop when high current is pulled.

This occurs when the board tries to do some intensive workload like serving alot of files at once.

This voltage drops below the CPU's operating voltage causing it to crash.

Note: this is a hypothesis but tests seems to confirm it.

LucHeart commented 11 months ago

note: it does not report a brownout...

hhvrc commented 11 months ago

That's true, but changing the power supply source significally decreases the likelyhood of a crash occuring, this has been tested on 3 seperate units.

I might be wrong in this being purely due to current draw, but a better power supply is tested to improve the reliability by a decent amount.

LucHeart commented 11 months ago

Still happens to me on a charger...

hhvrc commented 11 months ago

This seems like a hard problem to fix... What I can do is to manually implement the Stream that streams the file from FS to http and trigger the WDT_RESET from there, this would keep it from crashing. Temporary fix but should work. So I read 4kb from file, trigger WDT_RESET, write to http stream, WDT_RESET, repeat...

edit: I've tried both setting the WDT timeout and cancelling the WDT alltogether, none of these work, causes the board to crash