From fabec73d0e1242087fbf10f9c035bc530339c84a Mon Sep 17 00:00:00 2001 From: Terje Io Date: Sat, 7 Sep 2024 18:44:45 +0700 Subject: [PATCH] Added some RGB LED strip properties, improved handling of single meaning G-code words claimed by user M-codes. --- README.md | 2 +- changelog.md | 20 +++++++++++++++++++- gcode.c | 28 +++++++++++++++++++++++++++- grbl.h | 2 +- rgb.h | 10 ++++++++++ 5 files changed, 58 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ca63ff4..2b4bf61 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ It has been written to complement grblHAL and has features such as proper keyboa --- -Latest build date is 20240903, see the [changelog](changelog.md) for details. +Latest build date is 20240907, see the [changelog](changelog.md) for details. __NOTE:__ Build 20240222 has moved the probe input to the ioPorts pool of inputs and will be allocated from it when configured. The change is major and _potentially dangerous_, it may damage your probe, so please _verify correct operation_ after installing this, or later, builds. diff --git a/changelog.md b/changelog.md index 5e5529e..72fafe1 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,23 @@ ## grblHAL changelog +Build 20240907 + +Core: + +* Added some RGB LED strip properties, improved handling of single meaning G-code words claimed by user M-codes. + +Plugins: + +* Misc: updated for new RGB LED strip properties. + +Drivers: + +* iMRX1062, STM32F4xx and STM32F7xx: updated for new RGB LED strip properties. + +* RP2040: revised pin mappings for BTT SKR Pico board. Added misc. plugins to compilation. + +--- + Build 20240903 Core: @@ -8,7 +26,7 @@ Core: Drivers: -* ESP32, RP2040, STM32F4xx, STM32F7xx: updated for core changes related to the RGB HAL. +* ESP32, RP2040, STM32F4xx and STM32F7xx: updated for core changes related to the RGB HAL. * RP2040: renamed bluetooth files to avoid conflict with SDK. diff --git a/gcode.c b/gcode.c index 01d21b2..d1864ad 100644 --- a/gcode.c +++ b/gcode.c @@ -804,6 +804,12 @@ status_code_t gc_execute_block (char *block) #endif char *message = NULL; + struct { + float f; + uint32_t o; + float s; + tool_id_t t; + } single_meaning_value = {0}; block = gc_normalize_block(block, &message); @@ -1694,7 +1700,22 @@ status_code_t gc_execute_block (char *block) ijk_words.j = Off; if(user_words.k) ijk_words.k = Off; - + if(user_words.f) { + single_meaning_value.f = gc_block.values.f; + gc_block.values.f = 0.0f; + } + if(user_words.o) { + single_meaning_value.o = gc_block.values.o; + gc_block.values.o = 0; + } + if(user_words.s) { + single_meaning_value.s = gc_block.values.s; + gc_block.values.s = 0.0f; + } + if(user_words.t) { + single_meaning_value.t = gc_block.values.t; + gc_block.values.t = (tool_id_t)0; + } axis_words.mask = 0; } @@ -3313,7 +3334,12 @@ status_code_t gc_execute_block (char *block) if(gc_block.user_mcode_sync) protocol_buffer_synchronize(); // Ensure user defined mcode is executed when specified in program. + gc_block.words.mask = user_words.mask; + gc_block.values.f = single_meaning_value.f; + gc_block.values.o = single_meaning_value.o; + gc_block.values.s = single_meaning_value.s; + gc_block.values.t = single_meaning_value.t; hal.user_mcode.execute(state_get(), &gc_block); gc_block.words.mask = 0; } diff --git a/grbl.h b/grbl.h index 87ab84a..fe0804c 100644 --- a/grbl.h +++ b/grbl.h @@ -42,7 +42,7 @@ #else #define GRBL_VERSION "1.1f" #endif -#define GRBL_BUILD 20240903 +#define GRBL_BUILD 20240907 #define GRBL_URL "https://github.com/grblHAL" diff --git a/rgb.h b/rgb.h index ff47b7d..8bd7cce 100644 --- a/rgb.h +++ b/rgb.h @@ -41,6 +41,15 @@ typedef union { }; } rgb_color_t; +typedef union { + uint8_t mask; + struct { + uint8_t is_blocking :1, + is_strip :1, + unassigned :6; + }; +} rgb_properties_t; + /*! \brief Pointer to function for setting RGB (LED) output. \param color a \a rgb_color_t union. */ @@ -68,6 +77,7 @@ typedef struct { rgb_write_ptr write; //!< Optional handler for outputting data to Neopixel strip. rgb_set_intensity_ptr set_intensity; //!< Optional handler for setting intensity, range 0 - 255. rgb_color_t cap; //!< Driver capability, color value: 0 - not available, 1 - on off, > 1 - intensity range 0 - n. + rgb_properties_t flags; //!< Driver property flags. uint16_t num_devices; //!< Number of devices (LEDs) available. } rgb_ptr_t;