Added setting definitions for WebUI client inactivity timeout and real time report auto interval.

This commit is contained in:
Terje Io
2022-09-16 15:11:05 +02:00
parent e38c1ddaf1
commit 99bf98e409
6 changed files with 113 additions and 9 deletions
+2 -2
View File
@@ -11,7 +11,7 @@ It has been written to complement grblHAL and has features such as proper keyboa
---
Latest build date is 20220914, see the [changelog](changelog.md) for details.
Latest build date is 20220916, see the [changelog](changelog.md) for details.
__NOTE:__ A settings reset will be performed on an update for versions earlier than 20211122. Backup and restore of settings is recommended.
__IMPORTANT!__ A new setting has been introduced for ganged axes motors in version 20211121.
I have only bench tested this for a couple of drivers, correct function should be verified after updating by those who have more than three motors configured.
@@ -84,4 +84,4 @@ List of Supported G-Codes:
Some [plugins](https://github.com/grblHAL/plugins) implements additional M-codes.
---
2022-09-07
2022-09-16
+18 -2
View File
@@ -1,5 +1,21 @@
## grblHAL changelog
20220916:
Core:
* Added setting definitions for WebUI client inactivity timeout and real time report auto interval.
Plugins:
* WebUI: Added support for multiple client switchover and session inactivity timeout. Updated for websocket API changes.
Reorganized ESP v2 and v3 protocol code for readability and added settings for client inactivity \(`$396`\) real time report auto interval \(`$397`\).
__NOTE:__ This will reset WebUI settings to default and possibly other plugin settings too. Backup and restore!
* Networking: Enhanced websocket daemon API, now allows multiple clients - with the limitation that only one can claim the websocket "serial" stream.
---
20220914:
Core:
@@ -8,10 +24,10 @@ Core:
Plugins:
* WebUI: Sort ESP400 output by settings group, fixed ESP410 response and added free memory to ESP400 response when available from the HAL.
* WebUI: Sort ESP400 output by settings group, fixed ESP410 response and added free memory to ESP420 response when available from the HAL.
Updated for websocket API changes.
* Networking: removed WebUI specific code from websocket daemon, made API more flexible. Some bug fixes and a bit of code cleanup/refactoring.
* Networking: Removed WebUI specific code from websocket daemon, made API more flexible. Some bug fixes and a bit of code cleanup/refactoring.
* SDCard: Switched to VFS file handling for the YModem protocol.
+1 -1
View File
@@ -34,7 +34,7 @@
#else
#define GRBL_VERSION "1.1f"
#endif
#define GRBL_BUILD 20220914
#define GRBL_BUILD 20220916
// The following symbols are set here if not already set by the compiler or in config.h
// Do NOT change here!
+87 -3
View File
@@ -1436,8 +1436,6 @@ char *setting_get_value (const setting_detail_t *setting, uint_fast16_t offset)
if(setting == NULL)
return NULL;
setting_id_t id = (setting_id_t)(setting->id + offset);
switch(setting->type) {
case Setting_NonCore:
@@ -1484,7 +1482,10 @@ char *setting_get_value (const setting_detail_t *setting, uint_fast16_t offset)
case Setting_NonCoreFn:
case Setting_IsExtendedFn:
case Setting_IsLegacyFn:
case Setting_IsExpandedFn:
case Setting_IsExpandedFn:;
setting_id_t id = (setting_id_t)(setting->id + offset);
switch(setting->datatype) {
case Format_Decimal:
@@ -1510,6 +1511,89 @@ char *setting_get_value (const setting_detail_t *setting, uint_fast16_t offset)
return value;
}
uint32_t setting_get_int_value (const setting_detail_t *setting, uint_fast16_t offset)
{
uint32_t value = 0;
switch(setting->type) {
case Setting_NonCore:
case Setting_IsExtended:
case Setting_IsLegacy:
case Setting_IsExpanded:
switch(setting->datatype) {
case Format_Int8:
case Format_Bool:
case Format_Bitfield:
case Format_XBitfield:
case Format_AxisMask:
case Format_RadioButtons:
value = *((uint8_t *)(setting->value));
break;
case Format_Int16:
value = *((uint16_t *)(setting->value));
break;
case Format_Integer:
value = *((uint32_t *)(setting->value));
break;
default:
break;
}
break;
case Setting_NonCoreFn:
case Setting_IsExtendedFn:
case Setting_IsLegacyFn:
case Setting_IsExpandedFn:
switch(setting->datatype) {
case Format_Decimal:
case Format_String:
case Format_Password:
case Format_IPv4:
break;
default:
value = ((setting_get_int_ptr)(setting->get_value))((setting_id_t)(setting->id + offset));
break;
}
break;
}
return value;
}
float setting_get_float_value (const setting_detail_t *setting, uint_fast16_t offset)
{
float value = NAN;
if(setting->datatype == Format_Decimal) switch(setting->type) {
case Setting_NonCore:
case Setting_IsExtended:
case Setting_IsLegacy:
case Setting_IsExpanded:
value = *((float *)(setting->value));
break;
case Setting_NonCoreFn:
case Setting_IsExtendedFn:
case Setting_IsLegacyFn:
case Setting_IsExpandedFn:
value = ((setting_get_float_ptr)(setting->get_value))((setting_id_t)(setting->id + offset));
break;
default:
break;
}
return value;
}
static bool is_setting_available (const setting_detail_t *setting)
{
bool available = false;
+4
View File
@@ -264,6 +264,8 @@ typedef enum {
Setting_DoorCoolantOnDelay = 393,
Setting_SpindleOnDelay = 394, // made available if safety door input not provided
Setting_SpindleType = 395,
Setting_WebUiTimeout = 396,
Setting_WebUiAutoReportInterval = 397,
Setting_EncoderSettingsBase = 400, // NOTE: Reserving settings values >= 400 for encoder settings. Up to 449.
Setting_EncoderSettingsMax = 449,
@@ -811,6 +813,8 @@ setting_datatype_t setting_datatype_to_external (setting_datatype_t datatype);
setting_group_t settings_normalize_group (setting_group_t group);
const setting_group_detail_t *setting_get_group_details (setting_group_t id);
char *setting_get_value (const setting_detail_t *setting, uint_fast16_t offset);
uint32_t setting_get_int_value (const setting_detail_t *setting, uint_fast16_t offset);
float setting_get_float_value (const setting_detail_t *setting, uint_fast16_t offset);
setting_id_t settings_get_axis_base (setting_id_t id, uint_fast8_t *idx);
bool setting_is_list (const setting_detail_t *setting);
void setting_remove_elements (setting_id_t id, uint32_t mask);
+1 -1
View File
@@ -279,7 +279,7 @@ static bool stream_select (const io_stream_t *stream, bool add)
if(!hal.stream.write_all)
hal.stream.write_all = base.next != NULL ? stream_write_all : hal.stream.write;
if(stream->type == StreamType_WebSocket)
if(stream->type == StreamType_WebSocket && !stream->state.webui_connected)
hal.stream.state.webui_connected = webui_connected;
hal.stream.set_enqueue_rt_handler(protocol_enqueue_realtime_command);