Files
grblHAL/pid.h
Terje Io 2c58f0de09 Spindle handling refactoring for improved management and configuration of multiple spindles.
NOTE: this is a relatively large change and may have introduced bugs and/or unintended side-effects. Please report any issues!

Added setting $519 for binding spindle encoder to given spindle in multi spindle configurations.

Added machine readable spindle enumeration report, $SPINDLESH.

Increased default value for setting $398 (number of planner blocs) from 35 to 100 for faster laser engraving.
NOTE: the $398 setting value will not change on an upgrade!
NOTE: STM32F103 builds for the 128K flash variants does not have enough free RAM and will keep 35 as the default value.

Increased allowed number of decimal places from 3 to 5 for $10x stepper step/mm settings. Ref. ioSender issue 346.

Added setting $650 for filing system options. Ref. issue 397.
Currently the following bits are available (depending on the configuration):
0 - Auto mount SD card on startup (1).
1 - Do not add littlefs files when listing the root directory (2).

Added build option for lathe UVW mode.
When enabled UVW words can be used to command relative moves for XYZ without switching to relative mode with G91.
NOTE: This permanently sets lathe mode and disables the $32 mode setting.

There are signature changes to some spindle, ioports enumeration and VFS filing system mount functions.

Added events to allow plugin code to handle tool table data, possibly stored on a SD card.
2023-12-12 09:51:59 +01:00

58 lines
1.4 KiB
C

/*
pid.h - An embedded CNC Controller with rs274/ngc (g-code) support
PID algorithm for closed loop control
NOTE: not referenced in the core grbl code
Part of grblHAL
Copyright (c) 2020-2023 Terje Io
Grbl is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _PID_H_
#define _PID_H_
#include <stdbool.h>
typedef struct {
float p_gain;
float i_gain;
float d_gain;
float p_max_error;
float i_max_error;
float d_max_error;
float deadband;
float max_error;
} pid_values_t;
typedef struct {
pid_values_t cfg;
float deadband;
float i_error;
float d_error;
float sample_rate_prev;
float error;
float max_error;
} pidf_t;
void pidf_reset (pidf_t *pid);
void pidf_init(pidf_t *pid, pid_values_t *config);
bool pidf_config_changed (pidf_t *pid, pid_values_t *config);
float pidf (pidf_t *pid, float command, float actual, float sample_rate);
#endif