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

[FEATURE REQUEST]Add grblHAL support : https://github.com/grblHAL #252

Closed
luc-github opened this issue Jul 27, 2022 · 121 comments
Closed

Comments

@luc-github
Copy link
Owner

As started to discuss here grblHAL/ESP32#39

@terjeio
Copy link

terjeio commented Jul 27, 2022

An initial update for WebUI 3.0 of the grblHAL WebUI plugin is now available. I am testing with a Nucleo STM32F756 board and the plugin should also work with the iMXRT1062 (Teensy 4.x) driver. Note that the ESP32 grblHAL driver does not use the plugin, I will backport the code changes to that later on.

@dresco is working on a STM32H7xx driver that has ethernet and SD card support, it will be possible to use the plugin for this driver when it is updated to use the latest grblHAL core.

@luc-github
Copy link
Owner Author

luc-github commented Jul 27, 2022

Ok understood - unfortunatly I have no STM boards, neither Teensy 4.x, but I can emulate webserver and board responses in webUI dev mode

I saw the the https://github.com/grblHAL/Plugin_WebUI but I was thinking was same code in https://github.com/grblHAL/ESP32 so I did not realized it was V3 based - I will have a look

@luc-github
Copy link
Owner Author

luc-github commented Jul 28, 2022

@terjeio you wrote

my plan to contact you about some issues I have encountered

Can you tell which ones ? I can start by these first

I have added the code base to test and build grblHAL webUI bac40f9
image

I need some confirmation :

I will check what play SD job commands you are using, reading https://github.com/grblHAL/core/wiki/SD-Card-implementation,-a-technical-walktrough it seems $F=<filename but I will double check

@terjeio
Copy link

terjeio commented Jul 28, 2022

Issues encountered:

ESP701 for querying the status of a running job suddenly (randomly) is no longer sent after a running a few. Reloading resumes the querying.

If wrong password is given on login correcting it and resubmitting leads to the USER field in the form data missing.

The default file system is FLASHFS, could this be the first listed in the target supportedFileSystems (in files.js) or perhaps read from the ESP800 response?

if (useUiContextFn.getValue("autoload") && currentFS == "") {
currentFS = "FLASH"
onSelectFS()
}

I've changed the code above and it seems to work but not sure if this has any side-effects (other than failure if none are specified):

        if (useUiContextFn.getValue("autoload") && currentFS == "") {
            currentFS = files.supported[0].value
            onSelectFS()
        }

Is grblHal typo correct ? I saw also different writing like GRBLHal and GRBLHAL

"grblHAL" is the correct version. The welcome message from the controller is not correct, but I have been reluctant to change it as it may break senders.

do you have a logo for grblHal

There are a few proposals but none has been decided upon. I have to make my mind up...

Do you want to go to https://github.com/grblHAL/ ?

Yes, I have changed this already.

I see on esp32 version you cannot update the webUI as do not use the maintenance page and directly flashed the webUI,
is that the same with pluggin ?

Yes. For the plugin changing this will require a flash filing system. I may add this later. If the WebUI is compiled into the binary then adding index.html.gz to the SD card www folder will override the one from the binary so there is an update path available. More work on this is needed on my end - perhaps adding download of a new version to the www folder as a first step?

I will check what play SD job commands you are using

I am using $F=, I can also use ESP220 (IIRC this is used by WebUI 2.1) but when I check your ESP3D source it seems to me that this (and some other commands) has been repurposed? The commands that may have been reporposed have the help text "??" in this list.

I see extra real time commands: ... Is that list complete / up to date ?

I am not sure it is up to date, I'll have to check. Most can be ignored?
Perhaps the most important change is the new Tool state, it would be great if WebUI could support grblHAL style tool change handling. And yes, this works even when running a job from the SD card.

Here are the preferences and target folder I created:

preferences.zip

grblHAL.zip


Should grblHAL get its own firmware target name and id?

Some ideas:

Can WebUI fetch the settings labels from the controller? grblHAL has dynamic settings handling - plugins may add new ones, even user defined plugins. In my sender the settings UI is built from information requested from the controller. I can easily add an ESP command for fetching a json formatted list of setting ids and labels (and even descriptions) in a json formatted response.

On a longer term todo list will it be possible to use the WebUI style settings handling? It will require the support for floats and a flag type where bit 0 controls the enable status for the rest.

@luc-github
Copy link
Owner Author

luc-github commented Jul 28, 2022

ESP701 for querying the status of a running job

Currently this command is for the ESP3D Gcode host not used for running job, why not use the ? like GRBL_ESP32 ?
I need to see your implementation, originally ESP command are send by http and answer come back by http too, unlike others commands which use websocket, if polling is stopped it means there is a crash that should be visible in dev console or an error in notifications panel

If wrong password is given on login correcting it and resubmitting leads to the USER field in the form data missing.
I need to check but I may did that on purpose to display or not the error message

The default file system is FLASHFS,

This is already the case, no ? Flash is the default because it is the one I know it is present for sure, so not sure what issue you meet

I am using $F=, I can also use ESP220

Yes these commands are used by GRBL_ESP32 which is only supported by WebUI 2.1, and since the GRBL_ESP32 is dropped, I did not maintained them in WebUI 3.0

I am not sure it is up to date, I'll have to check. Most can be ignored

it is just to allow these command to be used by macro using a text descriptor as they are not printable,

I also see some commands : ?,~,!` need to be update by the not printable code to be handled properly in grblHal, so will do

would be great if WebUI could support grblHAL style tool change handling.

You will have to tell me more what you expect for UI and behavior, but I see no issue to support it

target name and id?

The current webUI use grblhal as name, for the ID I did not defined it yet, but because it is not selectable for ESP3D, it is not major issue,
here the current list : https://github.com/luc-github/ESP3D/blob/3.0/esp3d/src/include/defines.h#L28-L36
If you are ok to use ID=80 I will set it, it will be used to be sure WebUI match the target FW

Can WebUI fetch the settings labels from the controller?
currently it is the case, everything is dynamic, these labels are then translated by translation tool to give better look and correct language

So actually you can add any sections / items you want in settings just follow current syntax, if need more type of settings, just need to define type, type constraint, rendering form and should be ok like others types

@luc-github
Copy link
Owner Author

luc-github commented Jul 28, 2022

Reading your version now

  • preferences content has some changes already, polling commands can have difference frequency
  • your issue with Flash FS as first is due to the order put in files.js but in latest version of WebUI order is correct
  • changed the play command by $F= as you did
  • Added all the modes you added

@luc-github
Copy link
Owner Author

I have updated and build the index.html.gz according your changes https://github.com/luc-github/ESP3D-WEBUI/blob/3.0/dist/CNC/GRBLHal/index.html.gz

I still need to update the real commands parts

I have also noticed you do not support the one session feature so many webUI can be open at once, is that a choice ? I won't recommend it

@terjeio
Copy link

terjeio commented Jul 28, 2022

ESP701 for querying the status of a running job

Currently this command is for the ESP3D Gcode host not used for running job, why not use the ? like GRBL_ESP32 ?
I need to see your implementation, originally ESP command are send by http and answer come back by http too, unlike others commands which use websocket, if polling is stopped it means there is a crash that should be visible in dev console or an error in notifications panel

Polling for the real time status continues, only the ESP701 request stops. If I remove the ESP701 request the stream status is not displayed even if it is available in the real-time report. I assume this could be changed to use the real time report instead?

The default file system is FLASHFS,

This is already the case, no ? Flash is the default because it is the one I know it is present for sure, so not sure what issue you meet

It is not present in the controllers using the plugin.

I am using $F=, I can also use ESP220

Yes these commands are used by GRBL_ESP32 which is only supported by WebUI 2.1, and since the GRBL_ESP32 is dropped, I did not maintained them in WebUI 3.0

Ok, this explains it. They should not have been reassigned to a different use then? Or was this a customization made by bdring and his team?

target name and id?

If you are ok to use ID=80 I will set it, it will be used to be sure WebUI match the target FW

If not needed I am ok with using ID=10 as I do not know what it is used for in your code.

Can WebUI fetch the settings labels from the controller?

currently it is the case, everything is dynamic, these labels are then translated by translation tool to give better look and correct language

Ok, what is the ESP command to use for returning those. And to be clear I am talking about the grblHAL settings where those not known by the WebUI does not have useful labels:

image

preferences content has some changes already, polling commands can have difference frequency

Ok, will update. Sun came out today after a period of rain - so it may take some time. And I will be away for a period starting Tuesday 2nd.

I have also noticed you do not support the one session feature so many webUI can be open at once, is that a choice ?

Definitely not - or at least until an abitration protocol can be added. Only one client should be in control at the time. As a first step I might add support for additional read-only clients - but this is longer term.

@luc-github
Copy link
Owner Author

luc-github commented Jul 28, 2022

It is not present in the controllers using the plugin.

I need to check if I have added a dependency on ESP800 settings

[ESP800]
{
"cmd": "800",
"status": "ok",
"data": {
 "FWVersion": "3.0.0.a111",
 "FWTarget": "grblhal",
 "FWTargetID": "80",
 "Setup": "Enabled",
 "SDConnection": "direct",
 "SerialProtocol": "raw",
 "Authentication": "Disabled",
 "WebCommunication": "Synchronous",
 "WebSocketIP": "localhost",
 "WebSocketPort": "81",
 "Hostname": "esp3d",
 "WiFiMode": "STA",
 "WebUpdate": "Enabled",
 "FileSystem": "LittleFS",
 "Time": "none",
}
}

grblHAL settings

these are in language pack - they are just translation from commands id : https://github.com/luc-github/ESP3D-WEBUI/blob/3.0/src/targets/CNC/grblHAL/translations/en.json

the one session feature

this feature is actually mostly handled by webUI, the FW just broadcast the last connected ID by websocket , so the old ID webUI automaticaly close - not hard to implement - I may try to do it if you want

I need to setup an esp32 system for grblHal as I am afraid I will do some blind code and may misunderstood some commands

if I replace the plugin files to existing ESP32 code would it work ? any other changes should I do - I can do changes manually and this will let me know also why current version is always in reset error on my board

Or was this a customization made by bdring and his team

In FluidNC they renamed all commands https://github.com/bdring/FluidNC/wiki/FluidNC-Commands-and-Settings

@dresco
Copy link

dresco commented Jul 28, 2022

@dresco is working on a STM32H7xx driver that has ethernet and SD card support, it will be possible to use the plugin for this driver when it is updated to use the latest grblHAL core.

Just fyi, have started looking at this. First issue is that I used the STMCubeIDE provided middleware for SD card access (using DMA & SDMMC peripheral) - which uses an older FatFs version. Am looking into what it's going to take to upgrade..

@terjeio should I aim for R0.13c as per F4/F7 etc, or latest R0.14b?

@terjeio
Copy link

terjeio commented Jul 28, 2022

the one session feature

this feature is actually mostly handled by webUI, the FW just broadcast the last connected ID by websocket , so the old ID webUI automaticaly close - not hard to implement - I may try to do it if you want

Wait... One step at a time please. I have some support issues to clear before I can dig into the details.

if I replace the plugin files to existing ESP32 code would it work ?

No, it is a major refactoring. Ideally I should update the ESP32 driver and the plugin so it could be used directly - I do not like to maintain duplicate code.

why current version is always in reset error on my board

Oops, I forgot to asnwer this, by default grblHAL uses normally closed switches for all inputs. Connect the reset pin to ground and you should be fine.

@dresco - the SD card plugin can work with earlier versions of FatFS, I should have used the version id provided by FatFS but are using the target MCU family for now for detection... If you update aim for the latest version.

@dresco
Copy link

dresco commented Jul 28, 2022

@dresco - the SD card plugin can work with earlier versions of FatFS, I should have used the version id provided by FatFS but are using the target MCU family for now for detection... If you update aim for the latest version.

Thanks, was actually the webui plugin that complained, may just be something minor...

@luc-github
Copy link
Owner Author

luc-github commented Jul 28, 2022

WebUI is updated to a7

[ESP800]
{
"cmd": "800",
"status": "ok",
"data": {
 "FWVersion": "3.0.0.a111",
 "FWTarget": "grblhal",
 "FWTargetID": "80",
 "Setup": "Enabled",
 "SDConnection": "direct",
 "SerialProtocol": "raw",
 "Authentication": "Disabled",
 "WebCommunication": "Synchronous",
 "WebSocketIP": "localhost",
 "WebSocketPort": "81",
 "Hostname": "esp3d",
 "WiFiMode": "STA",
 "WebUpdate": "Enabled",
 "FileSystem": "none",
 "Time": "none",
}
}

Now will check : https://github.com/grblHAL/core/wiki/Report-extensions
because additional grblHal states are not supported by webUI currently

@luc-github
Copy link
Owner Author

about : Can WebUI fetch the settings labels from the controller?
it is possible just need to define the format you want to use and I can customize the grblHal panel for settings because it is specific, currently I use the GRBL $$ display but we can imagine another command that do same and add label and constraint for each like for ESP3D settings even section if necessary and it will dynamically build the UI accordingly

@terjeio
Copy link

terjeio commented Jul 29, 2022

I have just committed an update to the ESP32 driver that uses (parts of) the WebUI plugin.
Add preferences.json to the root of the SD card.

I left the SerialProtocol value to Socket in the ESP800 response - not sure ift that is correct but it works for me.
There is flash filesystem support for the ESP32, I will change the Filesystem value later to reflect that.

Note that forms based autentication is not yet supported for the ESP32 driver.
I'll put improved settings handling down the list until the basic stuff is completed - forms based login and unified SD card handling are the largest items.

And BTW the ESP32 webserver is really slow compared to e.g. the iMXRT1062 controller where WebUI loads in the blink of an eye...

@luc-github
Copy link
Owner Author

luc-github commented Jul 29, 2022

I have just committed an update to the ESP32 driver that uses (parts of) the WebUI plugin.

Ok thank you I give a try tomorrow - I was out all day today and need to finish some code first

SerialProtocol value to Socket in the [ESP800 response] - it is fine - there is no use currently in WebUI but better to be consistent, if the need popup

Ho yes ESP32 sync webserver is very slow, the test I did on current grblHal is already far faster (it use the idf async http server right ?) I am not surprised on another chip the performances are better - on reprap they claim to have wifi file transfer of 1.2MB/s but they do not use esp webserver ...
I have also noticed performances issues related to SD luc-github/ESP3D#576, so I use SDfat instead of ESP32 SD library in ESP3D

thank you for the porting It will be easier for me to experiment - I will feedback you tomorrow

@luc-github
Copy link
Owner Author

luc-github commented Jul 30, 2022

Hi I have flashed my board with latest git and webui 3.0, very cool job thank you,

so I have some questions :

  • Is that a choice to not display the IP at start ? it is painful when board is in STA/Client mode but start in reset and so it is locked , cannot send any command to know the IP, I see mdns is present but no SSDP, so on windows, the only choice is to find info on DHCP server ...

  • ESP800

[ESP800]
FW version:1.1f
FW target:grblHAL
FW ID:80
SD connection:direct
Serial protocol:Socket
Authentication:Disabled
Web Communication:Synchronous
Web Socket IP:192.168.2.108
Web Socket Port:81
Hostname:Grbl
WiFi mode:AP
File system:directsd
Hostname:Grbl

Some comments :

  • In STA mode - it still display WiFi mode:AP
  • File system:directsd directsd is not supported should be none or spiffs or littlefs
  • Above status lead me to add a new flag : hostFS, because you mentioned you do not use Flash on some system, so the index.html.gz is hosted on SD (or USB may be in future), so WebUI update, preferences.json should be read/uploaded from/to SD/www, using the new flag hostFS would tell webUI where to load/save preferences.json, what do you think ?
  • Settings
    the settings use old format of 2.1 instead of 3.0, so they cannot be loaded, and webUI raise this error :
    WebUI and Firmware version are not compatible, WebUI 3.X has new output format for all ESP commands, the same as you used in about page, I enclose both format

3.0.txt
2.X.txt

Sorry to ask so many questions, hope you can answer before you will going to vacations - so I won't bother you 😸

Edit I see: $ES so I may use it instead of $$ to list grblHal settings, is that ok ? change command still seems same $<ID>=<value>, right ?
Edit2: if I read well need to send $EG then $ES then $$ to be able to display settings properly ?
any reason not to add the value in $ES ? it make a lot of queries and parsing that could at least be simplified by just adding value at last position of $ES line format, sender knowing $ES command should not need the $$, because $$ would be only for old senders for compatibility IMHO, I will handle the multiple queries anyway

@terjeio
Copy link

terjeio commented Jul 30, 2022

Is that a choice to not display the IP at start ?

Yes, as it cannot be displayed for all the platforms grblHAL supports, see this wiki page. I may add SSDP and/or add the IP address to the full status real-time report to fix this.

This is the latest v3 json version:

ESP800

{"cmd":"800","status":"ok","data":{"FWVersion":"1.1f","FWTarget":"grblHAL","FWTargetID":"80","Setup":"Enabled","SDConnection":"direct","SerialProtocol":"Socket","Authentication":"Enabled","WebCommunication":"Synchronous","WebSocketIP":"10.0.0.22","WebSocketPort":"81","Hostname":"Grbl","WiFiMode":"STA","WebUpdate":"Disabled","FileSystem":"none","Time":"none"}}

Note that the backend supports v2.1 as well as v3.0, I use the version parameter added to the ESP800 command to detect 3.0 and set the mode for all subsequent commands (until a new ESP800 is requested):
http://10.0.0.22/command?cmd=[ESP800]json=yes%20version=3.

the CPU freq is 19 - I guess this is wrong

Yep, it is the stepper code clock frequency, I have to add a new HAL value for the MCU clock...

$G ... what is the meaning of . in S0. ?

I guess it is for implying that the value is a float - inherited from legacy Grbl.

Form another side, is that normal to have F0 instead of F0.0

Good question, I have to check my code.

I see $ES so I may use it instead of $$ to list grblHal settings, is that ok ?

No, $ES is for getting information about the settings, not the values. There is an internal API for querying setting details which I use to generate the ESP400 response, for most grblHAL settings this is relatively straight forward. The settings API is designed to allow user defined settings (in plugins or board support code), these are also possible to query and will show up in the $ES response etc.

change command still seems same $<ID>=<value>, right ?

Correct. I try to be backwards compatible with the legacy Grbl specification, at least in spirit.

if I read well need to send $EG then $ES then $$ to be able to display settings properly ?

I would rather like to add a ESP command for querying setting details, same format as ESP400. I can even add most to ESP400 by just looping trough them instead of outputting those that your backend outputs.

any reason not to add the value in $ES ? it make a lot of queries and parsing that could at least be simplified by just adding value at last position of $ES line format, sender knowing $ES command should not need the $$, because $$ would be only for old senders for compatibility IMHO, I will handle the multiple queries anyway

The reason is that $ES is used once at startup (at least in my sender) to build the settings UI. $$ is then used to fetch the values as needed.

@luc-github
Copy link
Owner Author

luc-github commented Jul 30, 2022

Note that the backend supports v2.1 as well as v3.0, I use the version parameter added to the ESP800 command to detect 3.0 and set the mode for all subsequent commands (until a new ESP800 is requested):

Ok so I see the issue - I have manually sent [ESP800] in terminal to verify settings when checking the File system:directsd issue and that generate the problem

I would rather like to add a ESP command for querying setting details, same format as ESP400

The ESP400 management is not part of specific FW but common to all target ESP3D ESP3DLib GRBL_ESP32 grblHal etc...

if you want to merge all settings in ESP400 like format - I can remove the tab Features for grblHal, and handle these settings in grblHal tab, which give you all flexibility for the additional types, I would prefer not using [ESP400] command to avoid confusion if possible but something like $EX for extended settings display
@terjeio What do you think ?

Yes, as it cannot be displayed for all the platforms grblHAL supports, see this wiki page. I may add SSDP and/or add the IP address to the full status real-time report to fix this.

My question was because you already display
[MSG:WIFI STA ACTIVE]
so adding [MSG: IP XXX.XXX.XXX.XXX] when is possible is still better than nothing by hooking the get Ip event I think IMHO

When locked the ? seems not working so I am not sure putting IP in report is necessary, additionnaly it will add extra info that should not change, and this info is already in $I

Final question : what sender currently support all/most grblHal extra features ?
I have tried https://github.com/terjeio/ioSender/releases/download/2.0.40/ioSender.2.0.40.zip but it does not work on my Win11 and My norton AV does not like it, more over it remove each part of the sofware one by one saying there is a problem

This is mostly to have a reference to verify I interpret properly the new states in webUI

@terjeio
Copy link

terjeio commented Jul 30, 2022

I would prefer not using [ESP400] command to avoid confusion if possible but something like $EX for extended settings display
@terjeio What do you think ?

IMO it will be better to add a new ESP command that outputs the information in json format, possibly the same as ESP400 uses as you already have parser/UI builder code for that.

My question was because you already display
[MSG:WIFI STA ACTIVE]
so adding [MSG: IP XXX.XXX.XXX.XXX] when is possible is still better than nothing by hooking the get Ip event I think IMHO

I can add that but there will still be a problem with some controllers that uses native USB for communication as most of these loses any info sent before a client is connected. Not easy this...

When locked the ? seems not working

It should work - are you sure about this.

Final question : what sender currently support all/most grblHal extra features ?

Only ioSender as far as I know.

... but it does not work on my Win11 and My norton AV does not like it

Is it Norton blocking it? I have not signed the code as the certificate for doing so is expensive.

This is mostly to have a reference to verify I interpret properly the new states in webUI

There is only one new state Tool in the real-time report, Alarm and Run can have substates added if enabled in settings. These substates are added in the same way as for Hold. The $G report has some missing parser states added as well as some new ones.

@luc-github
Copy link
Owner Author

luc-github commented Jul 30, 2022

IMO it will be better to add a new ESP command

if you really want to use ESP command then keep ESP400, the parser need to be modified for the new types only - the command itself is not an issue if you use json format - the parsing is piece of cake, in all case I will remove the feature tab as it is duplicate with grblHal settings

It should work - are you sure about this.

I have reflashed to test the fixes in webUI I did and I cannot duplicate anymore ... I am stumped...

Is it Norton blocking it?

yes and deleting all files one by one, I have paused Norton and now everything seems working - only the SD tab seems unresponsive but it is working in webuI so - it is not a problem for me

The $G report has some missing parser states added as well as some new ones

Yes I need to add the news states
[GC:G0 G54 G17 G21 G90 G94 G49 G98 G50 M5 M9 T0 F0 S0. ] for GrblHal
[GC:G0 G54 G17 G21 G90 G94 _______________M5 M9 T0 F0 S0 _] forGRBL

Forget my comment about F0.0, it seems my GRBL fw do also F0instead ofF0.0`

I will check everything - thank you for all feed back and enjoy your vacations, I have everything to work now I think - this will keep me busy for a couple of days ^_^

@terjeio
Copy link

terjeio commented Jul 30, 2022

IMO it will be better to add a new ESP command

if you really want to use ESP command then keep ESP400, the parser need to be modified for the new types only - the command itself is not an issue if you use json format - the parsing is piece of cake, in all case I will remove the feature tab as it is duplicate with grblHal settings

Yes - I guess this makes it simpler for both me and you. The datatypes not directly supported by WebUI are 2 (exclusive bitfield), 4 (axismask) and 6 (decimal or float if you will, later I might add double precision support in the core as an option...).

Examples in ioSender:

$22 - homing enable (exclusive bitfield) - can be emulated imperfecly by your B type:

image
Disabled

image
Enabled

$5 - invert limit pins (axismask)

image
IMO this can be emulated by your B type so not really unsupported.

Yes I need to add the news states
[GC:G0 G54 G17 G21 G90 G94 G49 G98 G50 M5 M9 T0 F0 S0. ] for GrblHal
[GC:G0 G54 G17 G21 G90 G94 _______________M5 M9 T0 F0 S0 _] forGRBL

There are many more new ones, here is the source code in report.c and motion modes supported in gcode.h.
grblHAL also supports the G59.1, G59.2 and G59.3 offsets.

If you aim for perfection mapping of error and alarm codes to text should be pulled from the controller? Note that these can also be added to by third party code.

@luc-github
Copy link
Owner Author

. The datatypes not directly supported by WebUI are 2 (exclusive bitfield), 4 (axismask)

ho yes mask controls are a pain - I had some before and I converted all them to simple booleans, but I will see what I can do

If you aim for perfection mapping of error and alarm codes to text should be pulled from the controller?

No I am not - I will keep this part for then end because anyway all text need to be in translations packs so I currently just refer to code for that

There are many more new ones, here is the source code

Yes saw it - thank you

@terjeio
Copy link

terjeio commented Jul 31, 2022

I have committed some updates, noatbly forms based login (as used by WebUI 3.0) should now work and I have added IP address to the WIFI STA ACTIVE message.

@luc-github
Copy link
Owner Author

luc-github commented Jul 31, 2022

Ok will check that - I am still working on sanity check if not Flash is enabled - it was not a case I had planned so I am following every rat holes to be sure I did not forget anything

that bring me back to my question :

[ESP800] File system:"directsd" directsd is not supported should be none or spiffs or littlefs

Above status lead me to add a new flag : hostFS, because you mentioned you do not use Flash on some system, so the index.html.gz is hosted on SD (or USB may be in future), so WebUI update, preferences.json should be read/uploaded from/to SD/www,
So add a flag hostFS: "SD/www" in ESP800 answer would tell webUI where to load/save preferences.json, what do you think ?

Note: I have prepared a code to handle Bit Masks, but I will wait your decision of the format of [ESP400] with all settings to implement corresponding controls

@terjeio
Copy link

terjeio commented Jul 31, 2022

[ESP800] File system:"directsd" directsd is not supported should be none or spiffs or littlefs

none is a bit counterintuitive, could virtual be a more logical option?

Above status lead me to add a new flag : hostFS, because you mentioned you do not use Flash on some system, so the index.html.gz is hosted on SD (or USB may be in future), so WebUI update, preferences.json should be read/uploaded from/to SD/www,

In fact it is possible to fetch the WebUI from flash, but then from a read only file system. I do check if the file is available in the www folder and if so it will used instead.

So add a flag hostFS: "SD/www" in ESP800 answer would tell webUI where to load/save preferences.json, what do you think ?

That could work, even when file system virtualization is implemented. Perhaps hostFiles or hostPath is a better name? Which file system becomes irrelevant when virtualization is implemented?

Just for the fun of I added a few lines to auto push the real time status report (along the $G-parser state report if enabled and changes to the report) and it works!

Just add this code before webui_init() if you want to test it:

static on_execute_realtime_ptr on_execute_realtime;

static void auto_report (sys_state_t state)
{
    static uint32_t ms = 0;

    if(hal.get_elapsed_ticks() >= ms) {
        ms = hal.get_elapsed_ticks() + 3000; //ms
        if(hal.stream.state.webui_connected)
            protocol_enqueue_realtime_command(CMD_STATUS_REPORT);
    }

    on_execute_realtime(state);
}

and in webui_init() add:

    on_execute_realtime = grbl.on_execute_realtime;
    grbl.on_execute_realtime = auto_report;

Change $10 to enable auto-reporting of the parser state:

image

If this is of interest there should be a way to set the timeout?

@terjeio
Copy link

terjeio commented Sep 20, 2022

I have WebDAV enabled, e.g. when I change the Telnet setting WebDAV changes too and I get the hang.
Note that the settings flags for masks might not be consecutive, if the corresponding functionality is not enabled flags will be left out.

image

@luc-github
Copy link
Owner Author

I think it is duplicate ID problem I will recompile grblHAL with same settings as you to verify

@luc-github
Copy link
Owner Author

luc-github commented Sep 20, 2022

Hmm I do not know if it is an issue but I see a problem:
Where are the bits 4 -5 -6 ? I have a definition issue here

Currently I check Option size = size of the mask here 5

if you use index out of the array I may be in trouble, can you clarify the behavior ? should I look for max index to know the size of the integer array instead of the options array size itself?

{
   "F": "Networking/Networking",
   "P": "70",
   "T": "M",
   "V": "7",
   "H": "Network Services",
   "R": "1",
   "O": [
    {
     "Telnet": "0"
    },
    {
     "Websocket": "1"
    },
    {
     "HTTP": "2"
    },
    {
     "FTP": "3"
    },
    {
     "WebDAV": "7"
    }
   ]
  },

I reproduce the hang only if I change webdav actually

@terjeio
Copy link

terjeio commented Sep 20, 2022

if you use index out of the array I may be in trouble

Ok, the index it is the bit number in the mask. I'll try to encode/decode to the correct mask on my end?

@terjeio
Copy link

terjeio commented Sep 20, 2022

Saving any changed mask hangs with the Saving... modal at 0% and nothing in the network log...

@luc-github
Copy link
Owner Author

luc-github commented Sep 20, 2022

Value it the integer array
Option size is 5 => bits array is [][][][][]
Telnet is bit 0
Websocket is bit 1

so

 "O": [
    {
     "Telnet": "0"
    },
    {
     "Websocket": "1"
    },
    {
     "HTTP": "2"
    },
    {
     "FTP": "3"
    }]

is same as

"O": [
  
   {
    "Websocket": "1"
   },
   {
    "HTTP": "2"
   },
{
    "Telnet": "0"
   },
   {
    "FTP": "3"
   }]

Now if if you have non used bits (here 4 -5 - 6) I need to change the array size detection - but I need you confirmation

"O": [
  {
   "Telnet": "0"
  },
  {
   "Websocket": "1"
  },
  {
   "HTTP": "2"
  },
  {
   "FTP": "3"
  },
  {
   "WebDAV": "7"
  }
 ]

@luc-github
Copy link
Owner Author

arg I reproduce issue - but it was working when I tested orz...
image

@terjeio
Copy link

terjeio commented Sep 20, 2022

Yes, it is the same. But I will always deliver the bit id's in ascending order.

@luc-github
Copy link
Owner Author

so what about bits 4-5-6 ?

@terjeio
Copy link

terjeio commented Sep 20, 2022

so what about bits 4-5-6 ?

Functionality not available in the controller so left out. I can try to encode/decode (or rather pack/unpack) on my end if a problem for you.

@luc-github
Copy link
Owner Author

I just need to know what to use to know the array size - so I need to search the higher value in option value, it is ok

@luc-github
Copy link
Owner Author

luc-github commented Sep 20, 2022

both issues are now fixed : https://github.com/luc-github/ESP3D-WEBUI/blob/3.0/dist/CNC/GRBLHal/index.html.gz

I have question for you about the axis definition letters :
is that valid ?
1 axis => X and ? report exactly 1 position
2 axis =>X Y and ? report exactly 2 positions
3 axis =>X Y Z and ? report exactly 3 positions
4 axis =>X Y Z A and ? report exactly 4 positions
5 axis =>X Y Z A B and ? report exactly 5 positions
6 axis =>X Y Z A B C and ? report exactly 6 positions
7 axis =>X Y Z A B C U and ? report exactly 7 positions
8 axis =>X Y Z A B C U V and ? report exactly 8 positions

because you mentioned above XYZA is same as XYZU which confuse me - how do you assign letter ?

@terjeio
Copy link

terjeio commented Sep 20, 2022

both issues are now fixed

ok, will test.

I have question for you about the axis definition letters :

1 and 2 axes are not supported, minimum is 3

If ABC is remapped to UVW then 4, 5 and 6 axes will be

4 axis =>X Y Z U and ? report exactly 4 positions
5 axis =>X Y Z U V and ? report exactly 5 positions
6 axis =>X Y Z U V W and ? report exactly 6 positions

and responses from the controller containing axis letters such as the |Pn: element in the real time report or settings labels will be changed to match.

@luc-github
Copy link
Owner Author

Hmm but you mentioned here #252 (comment) XYZABCUV will be for 8 axis

so if it is X Y Z U V W for 6 axis, what will be 7 and 8 axis letters ?

Sorry for my questions I want to be sure I go to the right direction

@terjeio
Copy link

terjeio commented Sep 20, 2022

so if it is X Y Z U V W for 6 axis, what will be 7 and 8 axis letters ?

ABC cannot be remapped to UVW if configuration is for more than 6 axes.

@luc-github
Copy link
Owner Author

ok thank you for the clarification , I will work on solutîon that handle these configurations transparently for user:
XYZABC
XYZUVW
XYZABCUV

@terjeio
Copy link

terjeio commented Sep 20, 2022

IMO there is no hurry to implement support for UVW, I do not expect it to become widely used - at least for some time.

I'll commit a fix for ESP701 soon, then we can say mission accomplished?

@luc-github
Copy link
Owner Author

luc-github commented Sep 20, 2022

IMO there is no hurry to implement support for UVW

Yes I need to think about it properly, it will be implemented as running change so it will be compatible with current and future implementation

I'll commit a fix for ESP701 soon, then we can say mission accomplished?

Cool - congratz for the task ^_^

I hope you are happy with the result

@terjeio
Copy link

terjeio commented Sep 20, 2022

I hope you are happy with the result

Yes, I am - I hope you are too.

I have just commited the fix for ESP701.

@luc-github
Copy link
Owner Author

Yes, I am - I hope you are too.

Yes ^_^ - and all your suggestions help me to improve webui and related projects so very happy

I have just commited the fix for ESP701

Ok cool will check that - so next is bug hunting and features not related to grblHAL so I will close topic
😸
Thank you for your help

@luc-github
Copy link
Owner Author

luc-github commented Sep 21, 2022

@terjeio I have opened a feature request for the new axis support, #268
I may need your input for the W axis support and conflict in Pn: <signal> report with W - Motor warning, new

Repository owner moved this from In Progress to Done in ESP3D 3.0 Sep 22, 2022
@terjeio
Copy link

terjeio commented Sep 26, 2022

I have commited a fix for the W conflict - I do not know of anybody using the motor warning and fault statuses so I moved those to different letters.

@luc-github
Copy link
Owner Author

Ok so I can push the update to support UVW and ABC now - cool ^_^

@github-actions
Copy link

github-actions bot commented Oct 7, 2022

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Status: Done
Development

No branches or pull requests

3 participants