luc-github / ESP3D-WEBUI

A Web UI for ESP8266 or ESP32 based boards connected to 3D printers / CNC
GNU General Public License v3.0
734 stars 303 forks source link

[BUG] Saving fails on a clean flash where there is no pre-existing preferences.json #290

Closed errolt closed 1 year ago

errolt commented 1 year ago

Describe the bug Saving settings fails with: "Error saving data"

To Reproduce Board: MKS DLC32. Do a complete flash erase: idf.py -p /dev/ttyUSB0 erase_flash Flash grblHAL ESP32: idf.py -p /dev/ttyUSB0 flash monitor Connect grlbHAL to wifi via $74 and $75 commands. Upload ESP32-WebUI index.html.gz to flash Now, if you chance anything on the Setting page and try to save you get the error message. If you export the json, rename it to preferances.json and upload it to the flash FS, then saving works. PS. Also gets this message on connection: 404 - File not found preferences.json

Expected behavior Able to save settings on a new install where there is no existing preferences.json

Screenshots image

ESP3D Firmware: (please complete the following information)

Target Firmware: (please complete the following information)

Board used (please complete the following information):

Browser used (please complete the following information):

Additional context Start with a clean flash.

github-actions[bot] commented 1 year ago

Thank your for submiting, please be sure you followed template or your issue may be dismissed.

luc-github commented 1 year ago

no preferences.json is not an issue , it will be generated as soon as you save the settings

errolt commented 1 year ago

Unfortunately that doesn't happen. I get "Error saving data", as depicted in the image.

luc-github commented 1 year ago

Please provide proper version of webui and grblhal - click on grblHAL image they should be displayed

errolt commented 1 year ago

Ahh. image

luc-github commented 1 year ago

I have older version of grblHAL and I have no issue - I need to update to see if I can reproduce your issue

luc-github commented 1 year ago

can you also share your CMakeLists.txt you used to configure grblHAL

errolt commented 1 year ago

CMakeLists.txt

Don't know if this would be useful:

$i
ok
[VER:1.1f.20221115:]
[OPT:VNMSL,35,1024,3,0]
[AXS:3:XYZ]
[NEWOPT:ENUMS,RT-,NOPROBE,REBOOT,TC,SED,RTC,WIFI,FTP,SD]
[FIRMWARE:grblHAL]
[NVS STORAGE:*FLASH]
[DRIVER:ESP32]
[DRIVER VERSION:221205]
[DRIVER OPTIONS:v4.3.4-309-g389a848a6a]
[BOARD:MKS DLC32 2.0]
[WIFI MAC:4C:75:25:6D:42:1C]
[IP:192.168.1.122]
[NETCON:Websocket]
[PLUGIN:WebUI v0.13]
[PLUGIN:SDCARD v1.07]
ok
errolt commented 1 year ago

Am I doing something dumb?

Some settings save successfully, like "steps/mm", or "step direction invert". But others like "soft limits enable" causes a save error.

still no preferences.json though.

luc-github commented 1 year ago

sorry you save which part ? Interface or Feature or GRBL, preferences.json is only for interface

Can you clarify I cannot duplicate on BOARD_BDRING_V3P5 "Compile for v3.5 3-axis board"

grbHal

Do you do different than the screen cast I just did ?

I will try to setup a DLC32 later - I should have one - but it should not be hardware dependent issue

errolt commented 1 year ago

Never mind. I'm sorry. I didn't see the three tabs on the settings screen. If I go to the second tab(Interface) and save then it does create a preferences.json file. I was confused in thinking that software limits would be part of the UI.

Sorry that I wasted your time.

luc-github commented 1 year ago

but you mentioned the error saving data - it is doing what ?

errolt commented 1 year ago

Maybe a feature not enabled in grblHAL?

If I go to settings, Features, and set "Soft Limits Enable" to Enabled, and save then "Error saving data". But this would probably be an issue with grblHAL, and probably not ESP3D-WEBUI.

It was just one of the settings I used to test, as it wouldn't cause hardware problems if I enable it.

luc-github commented 1 year ago

Ok I reproduce your issue enabling software limit

@terjeio I got {"cmd":"401","status":"error","data":"Set failed"} When using webui setting or manual command

[ESP401]P=20#0 T=B V=1 json=yes

[ESP400] give consistent

 {
   "F": "Limits/Limits",
   "P": "20#0",
   "T": "B",
   "V": "0",
   "H": "Soft limits enable",
   "O": [
    {
     "Enabled": "1"
    },
    {
     "Disabled": "0"
    }
   ]
  },

Any idea ?

luc-github commented 1 year ago

@terjeio it may be a missing boolean emulation ?

terjeio commented 1 year ago

The error is returned from $20 (enable soft limits) when homing is not enabled. Perhaps I should return the textual representation of the error code instead of the generic "Set failed"? For this it would be "Soft limits cannot be enabled without homing also enabled."

luc-github commented 1 year ago

yes it will be displayed in toaster and in notifications list.

luc-github commented 1 year ago

ok so I can close issue then

github-actions[bot] commented 1 year ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.