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

Step pulse off timing #1

Closed
buildlog opened this issue Jul 23, 2018 · 4 comments
Closed

Step pulse off timing #1

buildlog opened this issue Jul 23, 2018 · 4 comments

Comments

@buildlog
Copy link
Contributor

I am not sure why the step off pulse timing is not accurate. It is weird that it works, but not accurately. It might be due to how the timer is turned on or restarted.

One solution might be to capture the pulsed on time in microseconds with esp_timer_get_time(), finish the interrupt code and add an empty while loop until another esp_timer_get_time() reaches the off time. I hate while loops in interrupts, but it should only be for a few microseconds, some of which will already have expired running the code before the while loop.

Bart

@buildlog
Copy link
Contributor Author

The solution mentioned above appears to work fine.

I removed the timer interrupt that turns off the step pulse and replaced it with a delay loop at the end of the main stepper driver interrupt (void IRAM_ATTR onStepperDriverTimer())

// wait for step pulse time to complete...some of it should have expired during code above
while (esp_timer_get_time() < step_pulse_off_time)
{
NOP(); // spin here until time to turn off step
}
set_stepper_pins_on(0); // turn all off

The stock Grbl setting is 3 uSecs, which is also the minimum. I am not sure why that is a minimum, but I'll leave it. Common drivers like the TI DRV8825 require a step pulse length of 1.9uS.

I don't think it should impact performance because the time is so brief. You can't go any faster than what the minimum step pulse timing will allow anyways. I have not profiled the code before that, but it probably uses up much of the time.

I have not committed the code yet, in case anyone wants to comment on this.

@buildlog
Copy link
Contributor Author

For reference, here is the DRV8825 timing diagram.

image

@ggallant571
Copy link

I have been doing my own gcode processor for a couple of years using a STM32 device. Recently have started using various ESP devices for remote sensing projects. More than willing to migrate to your implementation.

@buildlog
Copy link
Contributor Author

Changed to use method described above.

bdring pushed a commit that referenced this issue Nov 8, 2018
JensHauser referenced this issue in JensHauser/Grbl_Esp32_JH Feb 13, 2021
-added "4axis_xyza.txt" to store Grbl_ESP32 config parameters.
So programming fits to parameters
- added 2 buttons (#1 hold/resume), #2 homing and tool change position
bdring added a commit that referenced this issue Mar 5, 2021
* Initial release with custom machine

* initial release

* Wrong addition corrected. AmoutOfToolChanges counts up now.

* pressing Z probe button once is fine, not a second time. reporting not in sequence to function flow

* First working FreeRTOS task with static text. Send "471" every second to all outputs

* Z Probe triggered correctly at button pressed. Can read out all values

* gitignore

* running with state machine, repeatable results in test environment

* works, except that function "user_tool_change" starts the tool change and it will interfer with further g code running in parallel. tbd

* typo

* back to without RTOS.But doesnt move

* RTOS but only with "T1 m06". not with g code program

* hold is better than door

* initial wifi settings

* umlaute

* gitignore

* Fehler bei Limit_Mask

* Spindle_Type angepasst

* lower debounding after adding capacitor

* Revert "lower debounding after adding capacitor"

This reverts commit eadbec2.

* remove customized gitignore

* Revert "remove customized gitignore"

This reverts commit ce44131.

* reduce debounding period due to adding capacitor

* uncomment all tool change source code

* Tets Fräse 2.6 ok

* Fräse 2.6

* Falscher GPIO Pin für Fräse

* test

* Revert "test"

This reverts commit 1265435.

* No Bluetooth necessary

* OTA update (watch Windows firewall!)

* - rename custom machine file name
-added "4axis_xyza.txt" to store Grbl_ESP32 config parameters.
So programming fits to parameters
- added 2 buttons (#1 hold/resume), #2 homing and tool change position

* new Z probe button

* Z probe corretion

* Z probe correction

* Z probe correction

* Fixed Grbl.h

- I think I deleted the GRBL_VERSION line by accident when using the web based conflict editor

* Revert "Merge branch 'Devt' of https://github.com/bdring/Grbl_Esp32 into Devt"

This reverts commit 361558b, reversing
changes made to 811646f.

* Revert "Merge remote-tracking branch 'Grbl_Esp32_JH/master' into Devt"

This reverts commit 811646f, reversing
changes made to a61ab51.

* Update

- moved get_next_RMT_chan_num() to constructor
- [Discord discussion](https://discord.com/channels/780079161460916227/786364602223951882/817056437016592384)

Co-authored-by: Jens Hauser <44340656+JensHauser@users.noreply.github.com>
Co-authored-by: Mitch Bradley <wmb@firmworks.com>
Co-authored-by: JensHauser <jens@hauser-digital.de>
bdring added a commit that referenced this issue Mar 5, 2021
* Initial release with custom machine

* initial release

* Wrong addition corrected. AmoutOfToolChanges counts up now.

* pressing Z probe button once is fine, not a second time. reporting not in sequence to function flow

* First working FreeRTOS task with static text. Send "471" every second to all outputs

* Z Probe triggered correctly at button pressed. Can read out all values

* gitignore

* running with state machine, repeatable results in test environment

* works, except that function "user_tool_change" starts the tool change and it will interfer with further g code running in parallel. tbd

* typo

* back to without RTOS.But doesnt move

* RTOS but only with "T1 m06". not with g code program

* hold is better than door

* initial wifi settings

* umlaute

* gitignore

* Fehler bei Limit_Mask

* Spindle_Type angepasst

* lower debounding after adding capacitor

* Revert "lower debounding after adding capacitor"

This reverts commit eadbec2.

* remove customized gitignore

* Revert "remove customized gitignore"

This reverts commit ce44131.

* reduce debounding period due to adding capacitor

* uncomment all tool change source code

* Tets Fräse 2.6 ok

* Fräse 2.6

* Falscher GPIO Pin für Fräse

* test

* Revert "test"

This reverts commit 1265435.

* No Bluetooth necessary

* OTA update (watch Windows firewall!)

* - rename custom machine file name
-added "4axis_xyza.txt" to store Grbl_ESP32 config parameters.
So programming fits to parameters
- added 2 buttons (#1 hold/resume), #2 homing and tool change position

* new Z probe button

* Z probe corretion

* Z probe correction

* Z probe correction

* Fixed Grbl.h

- I think I deleted the GRBL_VERSION line by accident when using the web based conflict editor

* Revert "Merge branch 'Devt' of https://github.com/bdring/Grbl_Esp32 into Devt"

This reverts commit 361558b, reversing
changes made to 811646f.

* Revert "Merge remote-tracking branch 'Grbl_Esp32_JH/master' into Devt"

This reverts commit 811646f, reversing
changes made to a61ab51.

* RcServo Updates

- Improved disable. It was not always initially set correctly.
- Improved calibration. Now a calibration value greater than 1 moves the motor in a positive direction and a value less than 1 moves it in a negative direction regardless of min/max and direction inverts.

* Update Grbl.h

Update grbl.h

Co-authored-by: Jens Hauser <44340656+JensHauser@users.noreply.github.com>
Co-authored-by: Mitch Bradley <wmb@firmworks.com>
Co-authored-by: JensHauser <jens@hauser-digital.de>
bdring added a commit that referenced this issue Mar 5, 2021
* Fixed various small bugs (#605)

* Fixed various small bugs

* Fixed potential cast bug

* Fixed double reporting of errors

Co-authored-by: Stefan de Bruijn <stefan@nubilosoft.com>

* Stallguard tuning (#607)

* Devt (#571)

* Handles Tranimic drivers errors better

- If an unsupported driver is specified, it will give a message and not crash.

* Cleaned up unused files

Got rid of old unipolar files
Got rid of servo axis feature - it is a motor class now
Got rid of solenoid pen feature - never really used and it should be a motor class if it is.

* Fix ENABLE_AUTHENTICATION (#569)

* Fixed authentication code.

* Removed another const cast

Co-authored-by: Stefan de Bruijn <stefan@nubilosoft.com>

* Fix step leakage with inverted steps (#570)

* Fix step leakage with inverted steps

* Update build date for merge

Co-authored-by: Bart Dring <bdring@buildlog.net>

Co-authored-by: Stefan de Bruijn <atlaste@users.noreply.github.com>
Co-authored-by: Stefan de Bruijn <stefan@nubilosoft.com>
Co-authored-by: Mitch Bradley <wmb@firmworks.com>
Co-authored-by: Bart Dring <bdring@buildlog.net>

* Update platformio.ini

Per PR 583

* Created an enum for mode

* Removing some unused machine defs

* Added test machine definition

* Clean up for PR

* Remove test machine def.

Co-authored-by: Stefan de Bruijn <atlaste@users.noreply.github.com>
Co-authored-by: Stefan de Bruijn <stefan@nubilosoft.com>
Co-authored-by: Mitch Bradley <wmb@firmworks.com>
Co-authored-by: Bart Dring <bdring@buildlog.net>

* Basic testing Complete

* Made state variable volatile.

* Homing cycle settings (#613)

* Initial Tests Complete

* Update Grbl.h

* Update variables

Co-authored-by: Mitch Bradley <wmb@firmworks.com>

* fixed dual switches when inverted (#614)

* fixed dual switches when inverted

* Removed debug message

* Cleaning up the machine defs

Removed unused #defines.

* Store coordinate offsets in NVS (#611)

* Store coordinate offsets in NVS

* Handle both old Eeprom formats

* Implementing fixes (#616)

- Stop creating additional tasks when limit_init() gets called again from homing and resets
- Explicitly delete an object that was causing a memory loss.

* Update Grbl.h

* Tweak memory fix and add $H check for $Homing/Cycles

* Fix G28.1 and G30.1

* Update Grbl.h

* Homing cycle defaults (#624)

* Changed to add homing cycle defaults

There needs to be a way to set the homing cycle defaults in a machine definition.
There will likely be a better way to do this in the future.

* Update 10vSpindle.cpp

Had wrong error message

* Fixed typos and removed obsolete #defines

* Probe cleanup (#625)

* Cleanup probing code

* Update Grbl.h

* Update after review

* Update error_codes_en_US.csv

* More sd_close() to free memory (#622)

* Changed buffer sizes to 256 throughout various parts of the program. (#626)

This is a patch necessary for F360 personal users, because they decided to add a very lengthy comment...

Co-authored-by: Stefan de Bruijn <stefan@nubilosoft.com>

* $sd/show and handle settings in SD files (#629)

* $sd/show and handle settings in SD files

* Added $LocalFs/Show and fixed $LocalFs/Run output

* Infer / at beginning of SD path name

The LocalFS path processing code already inserts
a / at the beginning of the path is one isn't
present.  This patch does the same for SD files.

* Show $ command responses in WebUI console

* Added $Settings/ListChanged AKA $SC

This is useful for saving settings in a compact form that
leaves defaults unchanged.

* $sd/show works in idle or alarm state

* Apply idle/alarm checks to SPIFFS files too

* Changed sd_close to SD.end()

sd_close was a temporary function to check for memory usage

* Big BUILD_INFO fix (#632)

-- Changes that affect behavior

Fixed the bugs with report_build_info()

Build info is no longer stored in the fixed "EEPROM" section; instead it
is a proper Setting named $Firmware/Build .  You can change it in the
usual way with $Firmware/Build=<whatever>

$I without the = still works.

-- Changes that affect configurability for developers

Converted a couple more #defines into enums - SETTINGS_RESTORE_*
and BITFLAG_RT_STATUS_* .  A side effect of this is that it is
no longer possible to configure the behavior of $RST=* by defining
SETTINGS_RESTORE_ALL to include only a subset.  I think it is
a bad idea from a customer support perspective to have the meaning
of this command be different for different builds.

Changed some of the #define ENABLE_ names to eliminate "EEPROM"

-- Changes that are purely cosmetic

Clarified descriptions in Config.h, to eliminate spurious/incorrect mentions
of "EEPROM"

Eliminated all mentions of the name "EEPROM" except the ones
that truly mean the EEPROM section, as opposed to generalized
non-volatile storage.

The contents of SettingsStorage.h and SettingsStorage.cpp, which
were really related to coordinate storage in Eeprom, not proper
settings, were moved to Eeprom.h and Eeprom.cpp.  The SettingsStorage
files are gone.

Got rid of get_step_pin_mask() and get_direction_pin_mask() because
they were just aliases for bit().  That eliminated some junk from
the SettingsStorage/Eeprom files.  Those files now tightly contain
only the residual stuff related to the storage of coordinate data
in EEPROM.

* Most #defines are gone (#595)

* Many more #defines bite the dust

* Fixed botch in rt accessory logic

* Update Probe.cpp

* Update System.cpp

* Typo

* Fixed WebUI crash (#633)

While eliminating a redundant definition of is_realtime_command(),
I inadvertently introduced a recursion due to the similarity of
the names "is_realtime_command()" and "is_realtime_cmd()".  The
solution is to eliminate the latter entirely.

* Fix i2s probing hang (#608)

* Fix I2S stepper hung just after the completion of motor moving

* Fix recompile issue

Fixed a problem with the recompile not being recompiled even if the files under the Custom folder are changed.

* More comment for macOS in debug.ini

* Fix the timing of calling I2S out's exclusion function and reset sequence

The reset sequence did not seem to be correct, so I changed it.
According to the ESP-IDF PR, the correct sequence is as follows:
1)TX module
2)DMA
3)FIFO
espressif/esp-idf@c7f3352#diff-27688c6b3c29373d2a2b142b8471981c

* Changed the message level for I2S swtiching from warning to debug

* Add some comments

* Implement stepping through Motors class (#636)

* Implement stepping through Motors class

WIP for discussion and review - not ready to merge yet

* Document Motor methods and variables

.. and remove some unused ones and move some
that are subclass-specific

* Move position_min/max to Limits.cpp

... and coalesced other uses thereof into a unified scheme.

* Call motor ->init() explicitly instead of implicitly

This makes it possible to inherit constructors without
spurious config messages.

* Fixed problems with I2S

* Changes in class method override syntax per atlaste

* Fixed oops

* More Motors simplification

a) Eliminated can_home() in favor of a return value from
set_homing_mode()
b) Eliminated axis_name() in favor of reportAxisNameMsg()

* Fixes to RcServo and Trinamic

- RC Servo was not handling disable ... probably old issue
- Display test after config

* More tweaks

* Define that variable!

* Move functions from Motors.cpp to subclasses

Created a Servo base class from which RcServo and
Dynamixel2 are derived.  This gets the servo update
task out of Motors.  It also eliminates the need for
type_id.  Now all of the functions that are specific
to particular kinds of motors are within their subclasses

* Adding Dynamixel to ABC axes.

* Removed second #ifndef SPINDLE_TYPE

* Fixed potential leak in Report.cpp

as reported by @atlaste

* Some servo cleanup. Has errors!

* min should be max

* Removed test rcservo machine definition.

* Removed obsolete #defines in machine defs for RcServo cal

Co-authored-by: bdring <barton.dring@gmail.com>

* Cleaned up AMASS code (#635)

* Cleaned up AMASS code

More #defines gone
74 lines shorter

Tested by comparing the result of original AMASS computation code to
the new code with values surrounding all of the cutoff frequencies.

* I2SOut tick calculation

* Sorted out units for stepper pulse periods

I tried to make it clear what the units are
at different places in the code, and to use
argument datatypes that clearly show the
value range at different points, instead of
relying on implicit type promotion.  Hopefully
this will make it easier to understand when,
where, and why unit conversions occur.

* Update Stepper.h

* Deleted AMASS Config.h option

... as it is no longer optional

* Use less memory (#644)

a) closeFile() now does SD.end() to release memory
after running a file from SD.
b) Several task stacks are smaller
c) All tasks now check their free space if DEBUG_REPORT_STACK_FREE
is defined.  platformio.ini has a commented-out line that can be
uncommented to turn that on.
d) Similarly, platformio.ini can turn on DEBUG_REPORT_HEAP_SIZE
e) Fixed a small leak that occurred when listing local files.

With these changes, the heap size tends to hover around 53K, dropping
to about 37K when running a file from SD.

* Add coolant pin messages to startup (#647)

* Add coolant pin messages to startup

Help with user support.

* Removing incorrect STEPPER_RESET definition

* Fix laser mode startup message

* cleanup

- coolant_init() will behave as before
- update build date
- return default machine to test_drive

* Move CoreXY out of main Grbl (#653)

* Created branch

* WIP

* Update parallel_delta.cpp

* Wip

* WIP

* Wip

* Still working on kinematics

- Added an interface into the jogging section

* WIP

* WIP

* wip

* WIP

* WIP

* Wip

* WIP

* WIP

* Wip

* Update machine defs

* Created branch

* WIP

* Update parallel_delta.cpp

* Wip

* WIP

* Wip

* Still working on kinematics

- Added an interface into the jogging section

* WIP

* WIP

* wip

* WIP

* WIP

* Wip

* WIP

* WIP

* Wip

* Update machine defs

* Machine def change. Moved switches to module 1

* WIP

* Cleanup before P.R.

- Fixed ranges for delta geometry
- Added post homing delay option for servos
- renamed and removed old machine defs.

* Fixing initialization problem when not in USE_KINEMATICS mode

* Fixing Git Mess

* Publishing Branch

- Not ready yet. Issues with Z axis
- Need to add midTbot option

* WIP

- Seems to be fully functional now.
- Need to add midTbot option.

* Update CoreXY.cpp

* I think it is ready for PR

- fixed $RST=#
- added midTbot geometry factor

* Fine tune midtbot definition

* Removed more unneeded corexy code.

* Fixed doubled #define in machine def file.

* Update after review comments

* Added $A AKA Alarms/List command (#654)

* Added $A AKA Alarms/List command

Similar to $E AKA Errors/List

$E used to be AKA ErrorCodes/List

Also added $Errors/Verbose setting to display
full error text instead of the error number.
It defaults to true because it works with every
sender I have tried so far - cncjs, UGS, and Chrome
GCode Sender.  If you have problems with some sender
you can set it to false.

* Added static_assert per atlaste's comment

* Added a default and fixed Authentication issue

Co-authored-by: bdring <barton.dring@gmail.com>

* TMC2130 plotter machine servo config update (#657)

* TMC2130 plotter machine servo config update

based on Slack conversation https://buildlog.slack.com/archives/CBZKZ8LHL/p1604243530253000

* Update Grbl.h

* Trinamic reporting (#656)

* Enhanced reporting of errors

* Change "motor" to "driver" for clarity.

* Added better way to show changed Setting values from Mitch

* Update build date

* Machine Definition Cleanup (#658)

- Removed machine definitions to speed up testing.
- Moved 6 pack CS/MS3 pins with other axis pins to help them stay in sync with the aixs letters

* Spindle delay and Telnet Fix (#676)

* Removed early saving of old state

Was causing later tests to be wrong

* Update Grbl.h

* Update TelnetServer.cpp

Remove filtering of '\r' character.

* ABC Bresenham counter init fix

* Rst responses (#679)

* Added verification of changes from $RST command

When sending $RST=$ you only get these responses.
[MSG:WiFi reset done]
[MSG:BT reset done]
Added the other things that change.
[MSG:WiFi reset done]
[MSG:BT reset done]
[MSG:Settings reset done]
[MSG:Postion offsets reset done]

* Update ProcessSettings.cpp

* Update Grbl.h

* Update ProcessSettings.cpp

* Fix Spindle State broken in earlier PR

* Update Grbl.h

* Spindle and laser (#683)

* WIP

* Updates

* Updates

- Added Laser/FullPower
- Move some stuff from PWM to Laser

* WIP

* Used the stop function before resetiing pins.

* Updates from discussion

- Reset_pins is now deinit()
- VFD task is now deleted when ... deinit()
- Added a Motor/Disable command

* Added Mitch's gambit

* Cleanup

- Finished VFD
- Fixed Settings (Thanks Brian!)
- changed task cores.

* Update VFDSpindle.cpp

* Update Laser.cpp

* Fixing reset

- gpio_reset_pin sets a pullup, which could turn on a device

* Changed Spindle messages to CLIENT_ALL

* Update Grbl.h

* Updates after review

* P.R. Cleanup

* Most spindle settings cause a new init()

* Laser mode (#692)

* Update Machine.h

* spindles now say if in laser mode

* name fix

* Updates

* Getting rid of crosstalk

* Update PWMSpindle.cpp

* Reset some values at spindle init()

* Update SettingsDefinitions.cpp

* Update Grbl.h

* Return to test_drive.h

* User macro button (#685)

* Test Macro Button Idea

* Updates

* Formating

* Changed macro pin reporting to be a single character

* Sd Web UI issues (#698)

* Updates

* returned reportTaskStackSize(uxHighWaterMark);

In a #ifdef DEBUG_TASK_STACK guard

* Disallow web commands unless idle or alarm state

* merging stuff after review

* Handle SD busy state in webserver handler (#697)

* Handle SD busy state in webserver handler

* Update index.html.gz

* Fixed reporting

* Add case for SD not enabled.

* Prevent Web commands except in idle or alarm

* Return authentication to the default

Co-authored-by: Mitch Bradley <wmb@firmworks.com>
Co-authored-by: Luc <8822552+luc-github@users.noreply.github.com>

* Update axis squaring checking (#699)

* Reverting some spindle changes...

CLIENT_ALL caused queue issues

* Rate Adjusting Fix

* Fix SD card hanging on bad gcode

* Fix hang on error 20 from SD/Run (#701)

* Fixed strange WCO values on first load (#702)

When loading Grbl_Esp32 into a fresh ESP32, the WCOs
would often have strange, very large, values.  The problem
was the code that tries to propagate data from the old
"Eeprom" storage format into the new NVS scheme.  The old
format had a broken checksum computation that made the
checksum so weak that if succeeds about half the time on
random data.

The solution is to get rid of all that old code.  The downside
is that migration from a build that uses the old format will
lose the WCO values.  The user will have to reestablish them.
Subsequent updates between different versions that both use
the new NVS format will propagate WCO values correctly.

* Fixes to homing (#706)

* Fixes to homing

* Update Grbl.h

* Clean up after code review.

* Trinamic uart (#700)

* WIP

* WIP

* Updates

* Update Grbl.h

* Removing some test machine definitions

* TMC5160 Drivers were not in tests

* Fix a few issues with VFDSpindle critical error handling (#705)

If a command is critical and fails to receive a response, it should trigger an Alarm. However, because the critical check was only evaluated if the spindle was not already unresponsive, it meant that a critical command failure would be silently ignored if a non-critical command failed before it (putting the VFDSpindle in unresponsive state). Therefore, I've moved the critical check to occur regardless of whether the spindle was already unresponsive.

Second, I believe that setting `sys_rt_exec_alarm` is not sufficient to stop the machine and put it into alarm state. Other alarm conditions (such as hard limits) also run an `mc_reset()` to stop motion first. It appears that without this, motion will not be stopped, and in fact, the alarm appears to get cleared if it occurs during motion!

* Update per P.R. #704 on main

* Update Motors.cpp

* Fix undefined probe reporting if inverted.

* Settings filtering via regular expressions (#717)

* Settings filtering via regular expressions

Implements only the most basic - and the most
useful - special characters - ^$.*

If the search string does not contain a special
character, it is interpreted as before.  Otherwise
the match is either more strict if anchored by
^ or $, or less strict if it contains a . wildcard
or a * repetition.

* Commentary

* Eliminated . metacharacter

* Fix SD/List repetition error (#727)

* Fix SD/List repetition error

The one line change that actually fixes it is
Serial.cpp line 162, where the SD state is compared
to "not busy" instead of "is idle", thus also handling
the "not present" case.

In the process, I converted the "const int SDCARD_ ..."
to an SDState enum class, thus proving type safety and
eliminating yet another untyped uint8_t .

* Updates after testing

Co-authored-by: bdring <barton.dring@gmail.com>

* Fixed RcServo Cals

* PWM fix and simplification (#722)

* PWM fix and simplification

This is an alternative solution to the PWM/ISR/float problem.

1. The set_level() argument is the exact value that is passed
to the LEDC Write function.  It can be interpreted as the
numerator of a rational fraction whose denominator is the
max PWM value, i.e. the precision, == 1 << _resolution_bits

2. There is a new denominator() method that returns the precision.

3. The sys_pwm_control(mask, duty, synchronize) function is
replaced by two functions sys_analog_all_off() and
sys_set_analog(io_num, duty).  This closely matches the
actual usage.  The old routine was called from two places,
one where the mask was alway 0xFF, the duty was always 0,
and synchronize was always false.  That is the one that
was troublesome from ISR context.  The other call always
affected a single pin, so the mask formulation with its
loop was useless extra baggage.  By splitting into two
functions, each one becomes much simpler, thus faster and
easier to understand.  The "synchronize" argument and
associated logic moved out to the caller (GCode.cpp),
which more closely reflects the behavioral logic.

4. For symmetry, sys_io_control() was similarly split.

5. sys_calc_pwm_precision() was moved into UserOutput.cpp
since is it driver specific, not a general system routine.

* Update Grbl.h

* Delete template.h

Co-authored-by: bdring <barton.dring@gmail.com>

* TMC2209 Stallguard (#748)

* TMC2209 Stallguard

- Added StallGuard homing support to TMC2209 (UART)
- Killed off TMC2208 for now. Too many conflicts with TMC2209. Will return with Diamond motor class hierarchy
- Increase StallGuard setting range for TMC2209. Constrianed in each class to actual limits
- Added a machine def to test TMC2209

* Update build date

* Web cmd modes (#754)

* Update System.cpp

* WebCommand with configurable modes

* Added a few more ESP commands to work in anu state

* Update Grbl.h

Co-authored-by: Mitch Bradley <wmb@firmworks.com>

* Updates from PWM_ISR_Fix branch (#755)

- $Message/Level
- ISR safe ledcWrite

* Core XY fixes (#756)

* Updates for CoreXY

* Delete fystec_ant.h

* Parking delay fix (#770)

* Changed delay type

- mc_dwell was causing a recursive loop the overflowed the stack
- See https://discord.com/channels/780079161460916227/786061602754396160/809288050387189782

* Changed spindle delays from floats to ints in spindle classes

- Used local copies, because I did not want to change/break the existing setting.

* Cleaning up parking

- Added a coolant delay setting
- Made an enum class for the dwell types
- Got rid of the safety door sepcific delays

* Update Grbl.h

* Enable per motor fix (#771)

* - moved invert option in front of per motor enables.

* Added code to prevent motors_set_disable() from setting values that already exist.

* Added the enable delay from PR 720

* Adding a defined default for step enable delay

* Fixing feed rates with kinematics and arcs.

- Kinematics changes the feed rate and the loop that creates arc was re-using the altered rate. This caused a runaway situation.

* SD Upload fix by luc (#779)

* Configure motors after I/O pins (#742)

So machine definitions can change the SPI pins before we talk to
any Trinamic drivers.

* 1.0.5 compilation fixes (#782)

* Fix compilations error due to new enum in esp32 core release 1.0.5

* Update Grbl.h

Co-authored-by: Luc <luc.@tech-hunters.com>

* Introduced delays for enable and direction pins (#720)

* Added some timing changes to steppers. Basically this should introduce a small (configurable) delay for enable and direction pins.

* Updates after testing

* Fixed small casting bug

* Fixed subtractions as per @Mitch's comments

* Added STEP_PULSE_DELAY handling for compatibility with RMT_STEPS. Functionality should be unchanged.

* Updates to help merge

Co-authored-by: Stefan de Bruijn <stefan@nubilosoft.com>
Co-authored-by: bdring <barton.dring@gmail.com>

* Vfd and mc_delay issues. Includes VFD sync speed. (#765)

* Added some timing changes to steppers. Basically this should introduce a small (configurable) delay for enable and direction pins.

* Updates after testing

* Fixed small casting bug

* Fixed subtractions as per @Mitch's comments

* Fixed busy flag in Stepper.cpp

* - Changed mc_dwell to double's, because float's have issues with context switches
- Changed spinup/spindown of VFD's to something more sensible
- Implemented advanced wait for spinup/spindown of VFD's

* Changed machine defs

* Implemented spindle speed sync. Made spindle safety polling optional; all the chatter appears to give issues somehow, not sure why.

* Made safety-polling optional.

* Added 'todo' for actual RPM code. Not sure how this should work though.

* Added safety check for unchanged RPM. Changed error output channels.

* Enabled the RPM code.

* Commented out again.

* Changed initialization sequence.
Implemented Huanyang initialization sequence.

* Made some fixes according to our latest insights in the manual

* Fixed docs.

* Fixed another bug in the comments

* Fixed set_speed RPM.

* Fixed huanyang message parsing. Fixed comments.

* Forgot a fall-through return.

* Updated status message after VFD initializes

* Changed output RPM test to output frequency test for sync.

* Changed mc_dwell to milliseconds and made it an integer. Fixed bug with negative values.
Fixed a dwelling bug in the VFD code, which would dwell indefinitely in cases such as safety door.

* Fixed a few small issues during the devt merge. Nothing serious.

* Not having critical initialization makes sense for the collet wrench lock thing (or just VFD's that are powered up later) in the sense that initialization should eventually happen to get the right values. Moreover, when the VFD enters an unresponsive state, re-initialization happens eventually.

* Changed 50 to 5000 for huanyang frequency calc.

* Updates after testing Huanyang

* Ran clang-format. Cleaned up the code a bit.

Co-authored-by: Stefan de Bruijn <stefan@nubilosoft.com>
Co-authored-by: bdring <barton.dring@gmail.com>

* Bug fixes (#790)

* Fix memory leak when answering webcommand (regression issue)

Fix wrong error code on  web command (regression issue)

* Fix sd code not disabled when SD Card feature is disabled

* Use proper error codes / messages

* Update Grbl.h

* Revert "Use proper error codes / messages"

This reverts commit ad49cf8.

* Updated error code symbols and text

- To be generic file system error

Co-authored-by: Luc <luc.@tech-hunters.com>
Co-authored-by: bdring <barton.dring@gmail.com>

* Get next rmt chan num fix (#793)

* Initial release with custom machine

* initial release

* Wrong addition corrected. AmoutOfToolChanges counts up now.

* pressing Z probe button once is fine, not a second time. reporting not in sequence to function flow

* First working FreeRTOS task with static text. Send "471" every second to all outputs

* Z Probe triggered correctly at button pressed. Can read out all values

* gitignore

* running with state machine, repeatable results in test environment

* works, except that function "user_tool_change" starts the tool change and it will interfer with further g code running in parallel. tbd

* typo

* back to without RTOS.But doesnt move

* RTOS but only with "T1 m06". not with g code program

* hold is better than door

* initial wifi settings

* umlaute

* gitignore

* Fehler bei Limit_Mask

* Spindle_Type angepasst

* lower debounding after adding capacitor

* Revert "lower debounding after adding capacitor"

This reverts commit eadbec2.

* remove customized gitignore

* Revert "remove customized gitignore"

This reverts commit ce44131.

* reduce debounding period due to adding capacitor

* uncomment all tool change source code

* Tets Fräse 2.6 ok

* Fräse 2.6

* Falscher GPIO Pin für Fräse

* test

* Revert "test"

This reverts commit 1265435.

* No Bluetooth necessary

* OTA update (watch Windows firewall!)

* - rename custom machine file name
-added "4axis_xyza.txt" to store Grbl_ESP32 config parameters.
So programming fits to parameters
- added 2 buttons (#1 hold/resume), #2 homing and tool change position

* new Z probe button

* Z probe corretion

* Z probe correction

* Z probe correction

* Fixed Grbl.h

- I think I deleted the GRBL_VERSION line by accident when using the web based conflict editor

* Revert "Merge branch 'Devt' of https://github.com/bdring/Grbl_Esp32 into Devt"

This reverts commit 361558b, reversing
changes made to 811646f.

* Revert "Merge remote-tracking branch 'Grbl_Esp32_JH/master' into Devt"

This reverts commit 811646f, reversing
changes made to a61ab51.

* Update

- moved get_next_RMT_chan_num() to constructor
- [Discord discussion](https://discord.com/channels/780079161460916227/786364602223951882/817056437016592384)

Co-authored-by: Jens Hauser <44340656+JensHauser@users.noreply.github.com>
Co-authored-by: Mitch Bradley <wmb@firmworks.com>
Co-authored-by: JensHauser <jens@hauser-digital.de>

* Rc servo updates (#794)

* Initial release with custom machine

* initial release

* Wrong addition corrected. AmoutOfToolChanges counts up now.

* pressing Z probe button once is fine, not a second time. reporting not in sequence to function flow

* First working FreeRTOS task with static text. Send "471" every second to all outputs

* Z Probe triggered correctly at button pressed. Can read out all values

* gitignore

* running with state machine, repeatable results in test environment

* works, except that function "user_tool_change" starts the tool change and it will interfer with further g code running in parallel. tbd

* typo

* back to without RTOS.But doesnt move

* RTOS but only with "T1 m06". not with g code program

* hold is better than door

* initial wifi settings

* umlaute

* gitignore

* Fehler bei Limit_Mask

* Spindle_Type angepasst

* lower debounding after adding capacitor

* Revert "lower debounding after adding capacitor"

This reverts commit eadbec2.

* remove customized gitignore

* Revert "remove customized gitignore"

This reverts commit ce44131.

* reduce debounding period due to adding capacitor

* uncomment all tool change source code

* Tets Fräse 2.6 ok

* Fräse 2.6

* Falscher GPIO Pin für Fräse

* test

* Revert "test"

This reverts commit 1265435.

* No Bluetooth necessary

* OTA update (watch Windows firewall!)

* - rename custom machine file name
-added "4axis_xyza.txt" to store Grbl_ESP32 config parameters.
So programming fits to parameters
- added 2 buttons (#1 hold/resume), #2 homing and tool change position

* new Z probe button

* Z probe corretion

* Z probe correction

* Z probe correction

* Fixed Grbl.h

- I think I deleted the GRBL_VERSION line by accident when using the web based conflict editor

* Revert "Merge branch 'Devt' of https://github.com/bdring/Grbl_Esp32 into Devt"

This reverts commit 361558b, reversing
changes made to 811646f.

* Revert "Merge remote-tracking branch 'Grbl_Esp32_JH/master' into Devt"

This reverts commit 811646f, reversing
changes made to a61ab51.

* RcServo Updates

- Improved disable. It was not always initially set correctly.
- Improved calibration. Now a calibration value greater than 1 moves the motor in a positive direction and a value less than 1 moves it in a negative direction regardless of min/max and direction inverts.

* Update Grbl.h

Update grbl.h

Co-authored-by: Jens Hauser <44340656+JensHauser@users.noreply.github.com>
Co-authored-by: Mitch Bradley <wmb@firmworks.com>
Co-authored-by: JensHauser <jens@hauser-digital.de>

Co-authored-by: Stefan de Bruijn <atlaste@users.noreply.github.com>
Co-authored-by: Stefan de Bruijn <stefan@nubilosoft.com>
Co-authored-by: Mitch Bradley <wmb@firmworks.com>
Co-authored-by: Bart Dring <bdring@buildlog.net>
Co-authored-by: odaki <odaki@mars.dti.ne.jp>
Co-authored-by: Pete Wildsmith <pete@weargoggles.co.uk>
Co-authored-by: Luc <8822552+luc-github@users.noreply.github.com>
Co-authored-by: Scott Bezek <scottbez1@gmail.com>
Co-authored-by: Florian Ragwitz <florian.ragwitz@gmail.com>
Co-authored-by: Luc <luc.@tech-hunters.com>
Co-authored-by: Jens Hauser <44340656+JensHauser@users.noreply.github.com>
Co-authored-by: JensHauser <jens@hauser-digital.de>
bdring added a commit that referenced this issue Mar 6, 2021
* Initial release with custom machine

* initial release

* Wrong addition corrected. AmoutOfToolChanges counts up now.

* pressing Z probe button once is fine, not a second time. reporting not in sequence to function flow

* First working FreeRTOS task with static text. Send "471" every second to all outputs

* Z Probe triggered correctly at button pressed. Can read out all values

* gitignore

* running with state machine, repeatable results in test environment

* works, except that function "user_tool_change" starts the tool change and it will interfer with further g code running in parallel. tbd

* typo

* back to without RTOS.But doesnt move

* RTOS but only with "T1 m06". not with g code program

* hold is better than door

* initial wifi settings

* umlaute

* gitignore

* Fehler bei Limit_Mask

* Spindle_Type angepasst

* lower debounding after adding capacitor

* Revert "lower debounding after adding capacitor"

This reverts commit eadbec2.

* remove customized gitignore

* Revert "remove customized gitignore"

This reverts commit ce44131.

* reduce debounding period due to adding capacitor

* uncomment all tool change source code

* Tets Fräse 2.6 ok

* Fräse 2.6

* Falscher GPIO Pin für Fräse

* test

* Revert "test"

This reverts commit 1265435.

* No Bluetooth necessary

* OTA update (watch Windows firewall!)

* - rename custom machine file name
-added "4axis_xyza.txt" to store Grbl_ESP32 config parameters.
So programming fits to parameters
- added 2 buttons (#1 hold/resume), #2 homing and tool change position

* new Z probe button

* Z probe corretion

* Z probe correction

* Z probe correction

* Fixed Grbl.h

- I think I deleted the GRBL_VERSION line by accident when using the web based conflict editor

* Revert "Merge branch 'Devt' of https://github.com/bdring/Grbl_Esp32 into Devt"

This reverts commit 361558b, reversing
changes made to 811646f.

* Revert "Merge remote-tracking branch 'Grbl_Esp32_JH/master' into Devt"

This reverts commit 811646f, reversing
changes made to a61ab51.

* Fixing double invert issue

- On StandardStepper the enable invert was being applied twice. One in Motors.cpp and once in StandardStepper.cpp.

* Update Grbl.h

Co-authored-by: Jens Hauser <44340656+JensHauser@users.noreply.github.com>
Co-authored-by: Mitch Bradley <wmb@firmworks.com>
Co-authored-by: JensHauser <jens@hauser-digital.de>
bdring added a commit that referenced this issue Mar 7, 2021
* Initial release with custom machine

* initial release

* Wrong addition corrected. AmoutOfToolChanges counts up now.

* pressing Z probe button once is fine, not a second time. reporting not in sequence to function flow

* First working FreeRTOS task with static text. Send "471" every second to all outputs

* Z Probe triggered correctly at button pressed. Can read out all values

* gitignore

* running with state machine, repeatable results in test environment

* works, except that function "user_tool_change" starts the tool change and it will interfer with further g code running in parallel. tbd

* typo

* back to without RTOS.But doesnt move

* RTOS but only with "T1 m06". not with g code program

* hold is better than door

* initial wifi settings

* umlaute

* gitignore

* Fehler bei Limit_Mask

* Spindle_Type angepasst

* lower debounding after adding capacitor

* Revert "lower debounding after adding capacitor"

This reverts commit eadbec2.

* remove customized gitignore

* Revert "remove customized gitignore"

This reverts commit ce44131.

* reduce debounding period due to adding capacitor

* uncomment all tool change source code

* Tets Fräse 2.6 ok

* Fräse 2.6

* Falscher GPIO Pin für Fräse

* test

* Revert "test"

This reverts commit 1265435.

* No Bluetooth necessary

* OTA update (watch Windows firewall!)

* - rename custom machine file name
-added "4axis_xyza.txt" to store Grbl_ESP32 config parameters.
So programming fits to parameters
- added 2 buttons (#1 hold/resume), #2 homing and tool change position

* new Z probe button

* Z probe corretion

* Z probe correction

* Z probe correction

* Fixed Grbl.h

- I think I deleted the GRBL_VERSION line by accident when using the web based conflict editor

* Revert "Merge branch 'Devt' of https://github.com/bdring/Grbl_Esp32 into Devt"

This reverts commit 361558b, reversing
changes made to 811646f.

* Revert "Merge remote-tracking branch 'Grbl_Esp32_JH/master' into Devt"

This reverts commit 811646f, reversing
changes made to a61ab51.

* Update SettingsDefinitions.cpp

- Double definition of direction_delay_microseconds & enable_delay_microseconds

* Update Grbl.h

Co-authored-by: Jens Hauser <44340656+JensHauser@users.noreply.github.com>
Co-authored-by: Mitch Bradley <wmb@firmworks.com>
Co-authored-by: JensHauser <jens@hauser-digital.de>
bdring added a commit that referenced this issue Mar 8, 2021
* Initial release with custom machine

* initial release

* Wrong addition corrected. AmoutOfToolChanges counts up now.

* pressing Z probe button once is fine, not a second time. reporting not in sequence to function flow

* First working FreeRTOS task with static text. Send "471" every second to all outputs

* Z Probe triggered correctly at button pressed. Can read out all values

* gitignore

* running with state machine, repeatable results in test environment

* works, except that function "user_tool_change" starts the tool change and it will interfer with further g code running in parallel. tbd

* typo

* back to without RTOS.But doesnt move

* RTOS but only with "T1 m06". not with g code program

* hold is better than door

* initial wifi settings

* umlaute

* gitignore

* Fehler bei Limit_Mask

* Spindle_Type angepasst

* lower debounding after adding capacitor

* Revert "lower debounding after adding capacitor"

This reverts commit eadbec2.

* remove customized gitignore

* Revert "remove customized gitignore"

This reverts commit ce44131.

* reduce debounding period due to adding capacitor

* uncomment all tool change source code

* Tets Fräse 2.6 ok

* Fräse 2.6

* Falscher GPIO Pin für Fräse

* test

* Revert "test"

This reverts commit 1265435.

* No Bluetooth necessary

* OTA update (watch Windows firewall!)

* - rename custom machine file name
-added "4axis_xyza.txt" to store Grbl_ESP32 config parameters.
So programming fits to parameters
- added 2 buttons (#1 hold/resume), #2 homing and tool change position

* new Z probe button

* Z probe corretion

* Z probe correction

* Z probe correction

* Fixed Grbl.h

- I think I deleted the GRBL_VERSION line by accident when using the web based conflict editor

* Revert "Merge branch 'Devt' of https://github.com/bdring/Grbl_Esp32 into Devt"

This reverts commit 361558b, reversing
changes made to 811646f.

* Revert "Merge remote-tracking branch 'Grbl_Esp32_JH/master' into Devt"

This reverts commit 811646f, reversing
changes made to a61ab51.

* Add example of external machine def

- This sets some of the important timing parameters.
- Removed redundant example to keep example count down

* Update Grbl.h

Co-authored-by: Jens Hauser <44340656+JensHauser@users.noreply.github.com>
Co-authored-by: Mitch Bradley <wmb@firmworks.com>
Co-authored-by: JensHauser <jens@hauser-digital.de>
bdring added a commit that referenced this issue Mar 15, 2021
* Fixed various small bugs (#605)

* Fixed various small bugs

* Fixed potential cast bug

* Fixed double reporting of errors

Co-authored-by: Stefan de Bruijn <stefan@nubilosoft.com>

* Stallguard tuning (#607)

* Devt (#571)

* Handles Tranimic drivers errors better

- If an unsupported driver is specified, it will give a message and not crash.

* Cleaned up unused files

Got rid of old unipolar files
Got rid of servo axis feature - it is a motor class now
Got rid of solenoid pen feature - never really used and it should be a motor class if it is.

* Fix ENABLE_AUTHENTICATION (#569)

* Fixed authentication code.

* Removed another const cast

Co-authored-by: Stefan de Bruijn <stefan@nubilosoft.com>

* Fix step leakage with inverted steps (#570)

* Fix step leakage with inverted steps

* Update build date for merge

Co-authored-by: Bart Dring <bdring@buildlog.net>

Co-authored-by: Stefan de Bruijn <atlaste@users.noreply.github.com>
Co-authored-by: Stefan de Bruijn <stefan@nubilosoft.com>
Co-authored-by: Mitch Bradley <wmb@firmworks.com>
Co-authored-by: Bart Dring <bdring@buildlog.net>

* Update platformio.ini

Per PR 583

* Created an enum for mode

* Removing some unused machine defs

* Added test machine definition

* Clean up for PR

* Remove test machine def.

Co-authored-by: Stefan de Bruijn <atlaste@users.noreply.github.com>
Co-authored-by: Stefan de Bruijn <stefan@nubilosoft.com>
Co-authored-by: Mitch Bradley <wmb@firmworks.com>
Co-authored-by: Bart Dring <bdring@buildlog.net>

* Basic testing Complete

* Made state variable volatile.

* Homing cycle settings (#613)

* Initial Tests Complete

* Update Grbl.h

* Update variables

Co-authored-by: Mitch Bradley <wmb@firmworks.com>

* fixed dual switches when inverted (#614)

* fixed dual switches when inverted

* Removed debug message

* Cleaning up the machine defs

Removed unused #defines.

* Store coordinate offsets in NVS (#611)

* Store coordinate offsets in NVS

* Handle both old Eeprom formats

* Implementing fixes (#616)

- Stop creating additional tasks when limit_init() gets called again from homing and resets
- Explicitly delete an object that was causing a memory loss.

* Update Grbl.h

* Tweak memory fix and add $H check for $Homing/Cycles

* Fix G28.1 and G30.1

* Update Grbl.h

* Homing cycle defaults (#624)

* Changed to add homing cycle defaults

There needs to be a way to set the homing cycle defaults in a machine definition.
There will likely be a better way to do this in the future.

* Update 10vSpindle.cpp

Had wrong error message

* Fixed typos and removed obsolete #defines

* Probe cleanup (#625)

* Cleanup probing code

* Update Grbl.h

* Update after review

* Update error_codes_en_US.csv

* More sd_close() to free memory (#622)

* Changed buffer sizes to 256 throughout various parts of the program. (#626)

This is a patch necessary for F360 personal users, because they decided to add a very lengthy comment...

Co-authored-by: Stefan de Bruijn <stefan@nubilosoft.com>

* $sd/show and handle settings in SD files (#629)

* $sd/show and handle settings in SD files

* Added $LocalFs/Show and fixed $LocalFs/Run output

* Infer / at beginning of SD path name

The LocalFS path processing code already inserts
a / at the beginning of the path is one isn't
present.  This patch does the same for SD files.

* Show $ command responses in WebUI console

* Added $Settings/ListChanged AKA $SC

This is useful for saving settings in a compact form that
leaves defaults unchanged.

* $sd/show works in idle or alarm state

* Apply idle/alarm checks to SPIFFS files too

* Changed sd_close to SD.end()

sd_close was a temporary function to check for memory usage

* Big BUILD_INFO fix (#632)

-- Changes that affect behavior

Fixed the bugs with report_build_info()

Build info is no longer stored in the fixed "EEPROM" section; instead it
is a proper Setting named $Firmware/Build .  You can change it in the
usual way with $Firmware/Build=<whatever>

$I without the = still works.

-- Changes that affect configurability for developers

Converted a couple more #defines into enums - SETTINGS_RESTORE_*
and BITFLAG_RT_STATUS_* .  A side effect of this is that it is
no longer possible to configure the behavior of $RST=* by defining
SETTINGS_RESTORE_ALL to include only a subset.  I think it is
a bad idea from a customer support perspective to have the meaning
of this command be different for different builds.

Changed some of the #define ENABLE_ names to eliminate "EEPROM"

-- Changes that are purely cosmetic

Clarified descriptions in Config.h, to eliminate spurious/incorrect mentions
of "EEPROM"

Eliminated all mentions of the name "EEPROM" except the ones
that truly mean the EEPROM section, as opposed to generalized
non-volatile storage.

The contents of SettingsStorage.h and SettingsStorage.cpp, which
were really related to coordinate storage in Eeprom, not proper
settings, were moved to Eeprom.h and Eeprom.cpp.  The SettingsStorage
files are gone.

Got rid of get_step_pin_mask() and get_direction_pin_mask() because
they were just aliases for bit().  That eliminated some junk from
the SettingsStorage/Eeprom files.  Those files now tightly contain
only the residual stuff related to the storage of coordinate data
in EEPROM.

* Most #defines are gone (#595)

* Many more #defines bite the dust

* Fixed botch in rt accessory logic

* Update Probe.cpp

* Update System.cpp

* Typo

* Fixed WebUI crash (#633)

While eliminating a redundant definition of is_realtime_command(),
I inadvertently introduced a recursion due to the similarity of
the names "is_realtime_command()" and "is_realtime_cmd()".  The
solution is to eliminate the latter entirely.

* Fix i2s probing hang (#608)

* Fix I2S stepper hung just after the completion of motor moving

* Fix recompile issue

Fixed a problem with the recompile not being recompiled even if the files under the Custom folder are changed.

* More comment for macOS in debug.ini

* Fix the timing of calling I2S out's exclusion function and reset sequence

The reset sequence did not seem to be correct, so I changed it.
According to the ESP-IDF PR, the correct sequence is as follows:
1)TX module
2)DMA
3)FIFO
espressif/esp-idf@c7f3352#diff-27688c6b3c29373d2a2b142b8471981c

* Changed the message level for I2S swtiching from warning to debug

* Add some comments

* Implement stepping through Motors class (#636)

* Implement stepping through Motors class

WIP for discussion and review - not ready to merge yet

* Document Motor methods and variables

.. and remove some unused ones and move some
that are subclass-specific

* Move position_min/max to Limits.cpp

... and coalesced other uses thereof into a unified scheme.

* Call motor ->init() explicitly instead of implicitly

This makes it possible to inherit constructors without
spurious config messages.

* Fixed problems with I2S

* Changes in class method override syntax per atlaste

* Fixed oops

* More Motors simplification

a) Eliminated can_home() in favor of a return value from
set_homing_mode()
b) Eliminated axis_name() in favor of reportAxisNameMsg()

* Fixes to RcServo and Trinamic

- RC Servo was not handling disable ... probably old issue
- Display test after config

* More tweaks

* Define that variable!

* Move functions from Motors.cpp to subclasses

Created a Servo base class from which RcServo and
Dynamixel2 are derived.  This gets the servo update
task out of Motors.  It also eliminates the need for
type_id.  Now all of the functions that are specific
to particular kinds of motors are within their subclasses

* Adding Dynamixel to ABC axes.

* Removed second #ifndef SPINDLE_TYPE

* Fixed potential leak in Report.cpp

as reported by @atlaste

* Some servo cleanup. Has errors!

* min should be max

* Removed test rcservo machine definition.

* Removed obsolete #defines in machine defs for RcServo cal

Co-authored-by: bdring <barton.dring@gmail.com>

* Cleaned up AMASS code (#635)

* Cleaned up AMASS code

More #defines gone
74 lines shorter

Tested by comparing the result of original AMASS computation code to
the new code with values surrounding all of the cutoff frequencies.

* I2SOut tick calculation

* Sorted out units for stepper pulse periods

I tried to make it clear what the units are
at different places in the code, and to use
argument datatypes that clearly show the
value range at different points, instead of
relying on implicit type promotion.  Hopefully
this will make it easier to understand when,
where, and why unit conversions occur.

* Update Stepper.h

* Deleted AMASS Config.h option

... as it is no longer optional

* Use less memory (#644)

a) closeFile() now does SD.end() to release memory
after running a file from SD.
b) Several task stacks are smaller
c) All tasks now check their free space if DEBUG_REPORT_STACK_FREE
is defined.  platformio.ini has a commented-out line that can be
uncommented to turn that on.
d) Similarly, platformio.ini can turn on DEBUG_REPORT_HEAP_SIZE
e) Fixed a small leak that occurred when listing local files.

With these changes, the heap size tends to hover around 53K, dropping
to about 37K when running a file from SD.

* Add coolant pin messages to startup (#647)

* Add coolant pin messages to startup

Help with user support.

* Removing incorrect STEPPER_RESET definition

* Fix laser mode startup message

* cleanup

- coolant_init() will behave as before
- update build date
- return default machine to test_drive

* Move CoreXY out of main Grbl (#653)

* Created branch

* WIP

* Update parallel_delta.cpp

* Wip

* WIP

* Wip

* Still working on kinematics

- Added an interface into the jogging section

* WIP

* WIP

* wip

* WIP

* WIP

* Wip

* WIP

* WIP

* Wip

* Update machine defs

* Created branch

* WIP

* Update parallel_delta.cpp

* Wip

* WIP

* Wip

* Still working on kinematics

- Added an interface into the jogging section

* WIP

* WIP

* wip

* WIP

* WIP

* Wip

* WIP

* WIP

* Wip

* Update machine defs

* Machine def change. Moved switches to module 1

* WIP

* Cleanup before P.R.

- Fixed ranges for delta geometry
- Added post homing delay option for servos
- renamed and removed old machine defs.

* Fixing initialization problem when not in USE_KINEMATICS mode

* Fixing Git Mess

* Publishing Branch

- Not ready yet. Issues with Z axis
- Need to add midTbot option

* WIP

- Seems to be fully functional now.
- Need to add midTbot option.

* Update CoreXY.cpp

* I think it is ready for PR

- fixed $RST=#
- added midTbot geometry factor

* Fine tune midtbot definition

* Removed more unneeded corexy code.

* Fixed doubled #define in machine def file.

* Update after review comments

* Added $A AKA Alarms/List command (#654)

* Added $A AKA Alarms/List command

Similar to $E AKA Errors/List

$E used to be AKA ErrorCodes/List

Also added $Errors/Verbose setting to display
full error text instead of the error number.
It defaults to true because it works with every
sender I have tried so far - cncjs, UGS, and Chrome
GCode Sender.  If you have problems with some sender
you can set it to false.

* Added static_assert per atlaste's comment

* Added a default and fixed Authentication issue

Co-authored-by: bdring <barton.dring@gmail.com>

* TMC2130 plotter machine servo config update (#657)

* TMC2130 plotter machine servo config update

based on Slack conversation https://buildlog.slack.com/archives/CBZKZ8LHL/p1604243530253000

* Update Grbl.h

* Trinamic reporting (#656)

* Enhanced reporting of errors

* Change "motor" to "driver" for clarity.

* Added better way to show changed Setting values from Mitch

* Update build date

* Machine Definition Cleanup (#658)

- Removed machine definitions to speed up testing.
- Moved 6 pack CS/MS3 pins with other axis pins to help them stay in sync with the aixs letters

* Spindle delay and Telnet Fix (#676)

* Removed early saving of old state

Was causing later tests to be wrong

* Update Grbl.h

* Update TelnetServer.cpp

Remove filtering of '\r' character.

* ABC Bresenham counter init fix

* Rst responses (#679)

* Added verification of changes from $RST command

When sending $RST=$ you only get these responses.
[MSG:WiFi reset done]
[MSG:BT reset done]
Added the other things that change.
[MSG:WiFi reset done]
[MSG:BT reset done]
[MSG:Settings reset done]
[MSG:Postion offsets reset done]

* Update ProcessSettings.cpp

* Update Grbl.h

* Update ProcessSettings.cpp

* Fix Spindle State broken in earlier PR

* Update Grbl.h

* Spindle and laser (#683)

* WIP

* Updates

* Updates

- Added Laser/FullPower
- Move some stuff from PWM to Laser

* WIP

* Used the stop function before resetiing pins.

* Updates from discussion

- Reset_pins is now deinit()
- VFD task is now deleted when ... deinit()
- Added a Motor/Disable command

* Added Mitch's gambit

* Cleanup

- Finished VFD
- Fixed Settings (Thanks Brian!)
- changed task cores.

* Update VFDSpindle.cpp

* Update Laser.cpp

* Fixing reset

- gpio_reset_pin sets a pullup, which could turn on a device

* Changed Spindle messages to CLIENT_ALL

* Update Grbl.h

* Updates after review

* P.R. Cleanup

* Most spindle settings cause a new init()

* Laser mode (#692)

* Update Machine.h

* spindles now say if in laser mode

* name fix

* Updates

* Getting rid of crosstalk

* Update PWMSpindle.cpp

* Reset some values at spindle init()

* Update SettingsDefinitions.cpp

* Update Grbl.h

* Return to test_drive.h

* User macro button (#685)

* Test Macro Button Idea

* Updates

* Formating

* Changed macro pin reporting to be a single character

* Sd Web UI issues (#698)

* Updates

* returned reportTaskStackSize(uxHighWaterMark);

In a #ifdef DEBUG_TASK_STACK guard

* Disallow web commands unless idle or alarm state

* merging stuff after review

* Handle SD busy state in webserver handler (#697)

* Handle SD busy state in webserver handler

* Update index.html.gz

* Fixed reporting

* Add case for SD not enabled.

* Prevent Web commands except in idle or alarm

* Return authentication to the default

Co-authored-by: Mitch Bradley <wmb@firmworks.com>
Co-authored-by: Luc <8822552+luc-github@users.noreply.github.com>

* Update axis squaring checking (#699)

* Reverting some spindle changes...

CLIENT_ALL caused queue issues

* Rate Adjusting Fix

* Fix SD card hanging on bad gcode

* Fix hang on error 20 from SD/Run (#701)

* Fixed strange WCO values on first load (#702)

When loading Grbl_Esp32 into a fresh ESP32, the WCOs
would often have strange, very large, values.  The problem
was the code that tries to propagate data from the old
"Eeprom" storage format into the new NVS scheme.  The old
format had a broken checksum computation that made the
checksum so weak that if succeeds about half the time on
random data.

The solution is to get rid of all that old code.  The downside
is that migration from a build that uses the old format will
lose the WCO values.  The user will have to reestablish them.
Subsequent updates between different versions that both use
the new NVS format will propagate WCO values correctly.

* Fixes to homing (#706)

* Fixes to homing

* Update Grbl.h

* Clean up after code review.

* Trinamic uart (#700)

* WIP

* WIP

* Updates

* Update Grbl.h

* Removing some test machine definitions

* TMC5160 Drivers were not in tests

* Fix a few issues with VFDSpindle critical error handling (#705)

If a command is critical and fails to receive a response, it should trigger an Alarm. However, because the critical check was only evaluated if the spindle was not already unresponsive, it meant that a critical command failure would be silently ignored if a non-critical command failed before it (putting the VFDSpindle in unresponsive state). Therefore, I've moved the critical check to occur regardless of whether the spindle was already unresponsive.

Second, I believe that setting `sys_rt_exec_alarm` is not sufficient to stop the machine and put it into alarm state. Other alarm conditions (such as hard limits) also run an `mc_reset()` to stop motion first. It appears that without this, motion will not be stopped, and in fact, the alarm appears to get cleared if it occurs during motion!

* Update per P.R. #704 on main

* Update Motors.cpp

* Fix undefined probe reporting if inverted.

* Settings filtering via regular expressions (#717)

* Settings filtering via regular expressions

Implements only the most basic - and the most
useful - special characters - ^$.*

If the search string does not contain a special
character, it is interpreted as before.  Otherwise
the match is either more strict if anchored by
^ or $, or less strict if it contains a . wildcard
or a * repetition.

* Commentary

* Eliminated . metacharacter

* Fix SD/List repetition error (#727)

* Fix SD/List repetition error

The one line change that actually fixes it is
Serial.cpp line 162, where the SD state is compared
to "not busy" instead of "is idle", thus also handling
the "not present" case.

In the process, I converted the "const int SDCARD_ ..."
to an SDState enum class, thus proving type safety and
eliminating yet another untyped uint8_t .

* Updates after testing

Co-authored-by: bdring <barton.dring@gmail.com>

* Fixed RcServo Cals

* PWM fix and simplification (#722)

* PWM fix and simplification

This is an alternative solution to the PWM/ISR/float problem.

1. The set_level() argument is the exact value that is passed
to the LEDC Write function.  It can be interpreted as the
numerator of a rational fraction whose denominator is the
max PWM value, i.e. the precision, == 1 << _resolution_bits

2. There is a new denominator() method that returns the precision.

3. The sys_pwm_control(mask, duty, synchronize) function is
replaced by two functions sys_analog_all_off() and
sys_set_analog(io_num, duty).  This closely matches the
actual usage.  The old routine was called from two places,
one where the mask was alway 0xFF, the duty was always 0,
and synchronize was always false.  That is the one that
was troublesome from ISR context.  The other call always
affected a single pin, so the mask formulation with its
loop was useless extra baggage.  By splitting into two
functions, each one becomes much simpler, thus faster and
easier to understand.  The "synchronize" argument and
associated logic moved out to the caller (GCode.cpp),
which more closely reflects the behavioral logic.

4. For symmetry, sys_io_control() was similarly split.

5. sys_calc_pwm_precision() was moved into UserOutput.cpp
since is it driver specific, not a general system routine.

* Update Grbl.h

* Delete template.h

Co-authored-by: bdring <barton.dring@gmail.com>

* TMC2209 Stallguard (#748)

* TMC2209 Stallguard

- Added StallGuard homing support to TMC2209 (UART)
- Killed off TMC2208 for now. Too many conflicts with TMC2209. Will return with Diamond motor class hierarchy
- Increase StallGuard setting range for TMC2209. Constrianed in each class to actual limits
- Added a machine def to test TMC2209

* Update build date

* Web cmd modes (#754)

* Update System.cpp

* WebCommand with configurable modes

* Added a few more ESP commands to work in anu state

* Update Grbl.h

Co-authored-by: Mitch Bradley <wmb@firmworks.com>

* Updates from PWM_ISR_Fix branch (#755)

- $Message/Level
- ISR safe ledcWrite

* Core XY fixes (#756)

* Updates for CoreXY

* Delete fystec_ant.h

* Parking delay fix (#770)

* Changed delay type

- mc_dwell was causing a recursive loop the overflowed the stack
- See https://discord.com/channels/780079161460916227/786061602754396160/809288050387189782

* Changed spindle delays from floats to ints in spindle classes

- Used local copies, because I did not want to change/break the existing setting.

* Cleaning up parking

- Added a coolant delay setting
- Made an enum class for the dwell types
- Got rid of the safety door sepcific delays

* Update Grbl.h

* Enable per motor fix (#771)

* - moved invert option in front of per motor enables.

* Added code to prevent motors_set_disable() from setting values that already exist.

* Added the enable delay from PR 720

* Adding a defined default for step enable delay

* Fixing feed rates with kinematics and arcs.

- Kinematics changes the feed rate and the loop that creates arc was re-using the altered rate. This caused a runaway situation.

* SD Upload fix by luc (#779)

* Configure motors after I/O pins (#742)

So machine definitions can change the SPI pins before we talk to
any Trinamic drivers.

* 1.0.5 compilation fixes (#782)

* Fix compilations error due to new enum in esp32 core release 1.0.5

* Update Grbl.h

Co-authored-by: Luc <luc.@tech-hunters.com>

* Introduced delays for enable and direction pins (#720)

* Added some timing changes to steppers. Basically this should introduce a small (configurable) delay for enable and direction pins.

* Updates after testing

* Fixed small casting bug

* Fixed subtractions as per @Mitch's comments

* Added STEP_PULSE_DELAY handling for compatibility with RMT_STEPS. Functionality should be unchanged.

* Updates to help merge

Co-authored-by: Stefan de Bruijn <stefan@nubilosoft.com>
Co-authored-by: bdring <barton.dring@gmail.com>

* Vfd and mc_delay issues. Includes VFD sync speed. (#765)

* Added some timing changes to steppers. Basically this should introduce a small (configurable) delay for enable and direction pins.

* Updates after testing

* Fixed small casting bug

* Fixed subtractions as per @Mitch's comments

* Fixed busy flag in Stepper.cpp

* - Changed mc_dwell to double's, because float's have issues with context switches
- Changed spinup/spindown of VFD's to something more sensible
- Implemented advanced wait for spinup/spindown of VFD's

* Changed machine defs

* Implemented spindle speed sync. Made spindle safety polling optional; all the chatter appears to give issues somehow, not sure why.

* Made safety-polling optional.

* Added 'todo' for actual RPM code. Not sure how this should work though.

* Added safety check for unchanged RPM. Changed error output channels.

* Enabled the RPM code.

* Commented out again.

* Changed initialization sequence.
Implemented Huanyang initialization sequence.

* Made some fixes according to our latest insights in the manual

* Fixed docs.

* Fixed another bug in the comments

* Fixed set_speed RPM.

* Fixed huanyang message parsing. Fixed comments.

* Forgot a fall-through return.

* Updated status message after VFD initializes

* Changed output RPM test to output frequency test for sync.

* Changed mc_dwell to milliseconds and made it an integer. Fixed bug with negative values.
Fixed a dwelling bug in the VFD code, which would dwell indefinitely in cases such as safety door.

* Fixed a few small issues during the devt merge. Nothing serious.

* Not having critical initialization makes sense for the collet wrench lock thing (or just VFD's that are powered up later) in the sense that initialization should eventually happen to get the right values. Moreover, when the VFD enters an unresponsive state, re-initialization happens eventually.

* Changed 50 to 5000 for huanyang frequency calc.

* Updates after testing Huanyang

* Ran clang-format. Cleaned up the code a bit.

Co-authored-by: Stefan de Bruijn <stefan@nubilosoft.com>
Co-authored-by: bdring <barton.dring@gmail.com>

* Bug fixes (#790)

* Fix memory leak when answering webcommand (regression issue)

Fix wrong error code on  web command (regression issue)

* Fix sd code not disabled when SD Card feature is disabled

* Use proper error codes / messages

* Update Grbl.h

* Revert "Use proper error codes / messages"

This reverts commit ad49cf8.

* Updated error code symbols and text

- To be generic file system error

Co-authored-by: Luc <luc.@tech-hunters.com>
Co-authored-by: bdring <barton.dring@gmail.com>

* Get next rmt chan num fix (#793)

* Initial release with custom machine

* initial release

* Wrong addition corrected. AmoutOfToolChanges counts up now.

* pressing Z probe button once is fine, not a second time. reporting not in sequence to function flow

* First working FreeRTOS task with static text. Send "471" every second to all outputs

* Z Probe triggered correctly at button pressed. Can read out all values

* gitignore

* running with state machine, repeatable results in test environment

* works, except that function "user_tool_change" starts the tool change and it will interfer with further g code running in parallel. tbd

* typo

* back to without RTOS.But doesnt move

* RTOS but only with "T1 m06". not with g code program

* hold is better than door

* initial wifi settings

* umlaute

* gitignore

* Fehler bei Limit_Mask

* Spindle_Type angepasst

* lower debounding after adding capacitor

* Revert "lower debounding after adding capacitor"

This reverts commit eadbec2.

* remove customized gitignore

* Revert "remove customized gitignore"

This reverts commit ce44131.

* reduce debounding period due to adding capacitor

* uncomment all tool change source code

* Tets Fräse 2.6 ok

* Fräse 2.6

* Falscher GPIO Pin für Fräse

* test

* Revert "test"

This reverts commit 1265435.

* No Bluetooth necessary

* OTA update (watch Windows firewall!)

* - rename custom machine file name
-added "4axis_xyza.txt" to store Grbl_ESP32 config parameters.
So programming fits to parameters
- added 2 buttons (#1 hold/resume), #2 homing and tool change position

* new Z probe button

* Z probe corretion

* Z probe correction

* Z probe correction

* Fixed Grbl.h

- I think I deleted the GRBL_VERSION line by accident when using the web based conflict editor

* Revert "Merge branch 'Devt' of https://github.com/bdring/Grbl_Esp32 into Devt"

This reverts commit 361558b, reversing
changes made to 811646f.

* Revert "Merge remote-tracking branch 'Grbl_Esp32_JH/master' into Devt"

This reverts commit 811646f, reversing
changes made to a61ab51.

* Update

- moved get_next_RMT_chan_num() to constructor
- [Discord discussion](https://discord.com/channels/780079161460916227/786364602223951882/817056437016592384)

Co-authored-by: Jens Hauser <44340656+JensHauser@users.noreply.github.com>
Co-authored-by: Mitch Bradley <wmb@firmworks.com>
Co-authored-by: JensHauser <jens@hauser-digital.de>

* Rc servo updates (#794)

* Initial release with custom machine

* initial release

* Wrong addition corrected. AmoutOfToolChanges counts up now.

* pressing Z probe button once is fine, not a second time. reporting not in sequence to function flow

* First working FreeRTOS task with static text. Send "471" every second to all outputs

* Z Probe triggered correctly at button pressed. Can read out all values

* gitignore

* running with state machine, repeatable results in test environment

* works, except that function "user_tool_change" starts the tool change and it will interfer with further g code running in parallel. tbd

* typo

* back to without RTOS.But doesnt move

* RTOS but only with "T1 m06". not with g code program

* hold is better than door

* initial wifi settings

* umlaute

* gitignore

* Fehler bei Limit_Mask

* Spindle_Type angepasst

* lower debounding after adding capacitor

* Revert "lower debounding after adding capacitor"

This reverts commit eadbec2.

* remove customized gitignore

* Revert "remove customized gitignore"

This reverts commit ce44131.

* reduce debounding period due to adding capacitor

* uncomment all tool change source code

* Tets Fräse 2.6 ok

* Fräse 2.6

* Falscher GPIO Pin für Fräse

* test

* Revert "test"

This reverts commit 1265435.

* No Bluetooth necessary

* OTA update (watch Windows firewall!)

* - rename custom machine file name
-added "4axis_xyza.txt" to store Grbl_ESP32 config parameters.
So programming fits to parameters
- added 2 buttons (#1 hold/resume), #2 homing and tool change position

* new Z probe button

* Z probe corretion

* Z probe correction

* Z probe correction

* Fixed Grbl.h

- I think I deleted the GRBL_VERSION line by accident when using the web based conflict editor

* Revert "Merge branch 'Devt' of https://github.com/bdring/Grbl_Esp32 into Devt"

This reverts commit 361558b, reversing
changes made to 811646f.

* Revert "Merge remote-tracking branch 'Grbl_Esp32_JH/master' into Devt"

This reverts commit 811646f, reversing
changes made to a61ab51.

* RcServo Updates

- Improved disable. It was not always initially set correctly.
- Improved calibration. Now a calibration value greater than 1 moves the motor in a positive direction and a value less than 1 moves it in a negative direction regardless of min/max and direction inverts.

* Update Grbl.h

Update grbl.h

Co-authored-by: Jens Hauser <44340656+JensHauser@users.noreply.github.com>
Co-authored-by: Mitch Bradley <wmb@firmworks.com>
Co-authored-by: JensHauser <jens@hauser-digital.de>

* Motor disable fix (#797)

* Initial release with custom machine

* initial release

* Wrong addition corrected. AmoutOfToolChanges counts up now.

* pressing Z probe button once is fine, not a second time. reporting not in sequence to function flow

* First working FreeRTOS task with static text. Send "471" every second to all outputs

* Z Probe triggered correctly at button pressed. Can read out all values

* gitignore

* running with state machine, repeatable results in test environment

* works, except that function "user_tool_change" starts the tool change and it will interfer with further g code running in parallel. tbd

* typo

* back to without RTOS.But doesnt move

* RTOS but only with "T1 m06". not with g code program

* hold is better than door

* initial wifi settings

* umlaute

* gitignore

* Fehler bei Limit_Mask

* Spindle_Type angepasst

* lower debounding after adding capacitor

* Revert "lower debounding after adding capacitor"

This reverts commit eadbec2.

* remove customized gitignore

* Revert "remove customized gitignore"

This reverts commit ce44131.

* reduce debounding period due to adding capacitor

* uncomment all tool change source code

* Tets Fräse 2.6 ok

* Fräse 2.6

* Falscher GPIO Pin für Fräse

* test

* Revert "test"

This reverts commit 1265435.

* No Bluetooth necessary

* OTA update (watch Windows firewall!)

* - rename custom machine file name
-added "4axis_xyza.txt" to store Grbl_ESP32 config parameters.
So programming fits to parameters
- added 2 buttons (#1 hold/resume), #2 homing and tool change position

* new Z probe button

* Z probe corretion

* Z probe correction

* Z probe correction

* Fixed Grbl.h

- I think I deleted the GRBL_VERSION line by accident when using the web based conflict editor

* Revert "Merge branch 'Devt' of https://github.com/bdring/Grbl_Esp32 into Devt"

This reverts commit 361558b, reversing
changes made to 811646f.

* Revert "Merge remote-tracking branch 'Grbl_Esp32_JH/master' into Devt"

This reverts commit 811646f, reversing
changes made to a61ab51.

* Fixing double invert issue

- On StandardStepper the enable invert was being applied twice. One in Motors.cpp and once in StandardStepper.cpp.

* Update Grbl.h

Co-authored-by: Jens Hauser <44340656+JensHauser@users.noreply.github.com>
Co-authored-by: Mitch Bradley <wmb@firmworks.com>
Co-authored-by: JensHauser <jens@hauser-digital.de>

* Remove doubled settings (#799)

* Initial release with custom machine

* initial release

* Wrong addition corrected. AmoutOfToolChanges counts up now.

* pressing Z probe button once is fine, not a second time. reporting not in sequence to function flow

* First working FreeRTOS task with static text. Send "471" every second to all outputs

* Z Probe triggered correctly at button pressed. Can read out all values

* gitignore

* running with state machine, repeatable results in test environment

* works, except that function "user_tool_change" starts the tool change and it will interfer with further g code running in parallel. tbd

* typo

* back to without RTOS.But doesnt move

* RTOS but only with "T1 m06". not with g code program

* hold is better than door

* initial wifi settings

* umlaute

* gitignore

* Fehler bei Limit_Mask

* Spindle_Type angepasst

* lower debounding after adding capacitor

* Revert "lower debounding after adding capacitor"

This reverts commit eadbec2.

* remove customized gitignore

* Revert "remove customized gitignore"

This reverts commit ce44131.

* reduce debounding period due to adding capacitor

* uncomment all tool change source code

* Tets Fräse 2.6 ok

* Fräse 2.6

* Falscher GPIO Pin für Fräse

* test

* Revert "test"

This reverts commit 1265435.

* No Bluetooth necessary

* OTA update (watch Windows firewall!)

* - rename custom machine file name
-added "4axis_xyza.txt" to store Grbl_ESP32 config parameters.
So programming fits to parameters
- added 2 buttons (#1 hold/resume), #2 homing and tool change position

* new Z probe button

* Z probe corretion

* Z probe correction

* Z probe correction

* Fixed Grbl.h

- I think I deleted the GRBL_VERSION line by accident when using the web based conflict editor

* Revert "Merge branch 'Devt' of https://github.com/bdring/Grbl_Esp32 into Devt"

This reverts commit 361558b, reversing
changes made to 811646f.

* Revert "Merge remote-tracking branch 'Grbl_Esp32_JH/master' into Devt"

This reverts commit 811646f, reversing
changes made to a61ab51.

* Update SettingsDefinitions.cpp

- Double definition of direction_delay_microseconds & enable_delay_microseconds

* Update Grbl.h

Co-authored-by: Jens Hauser <44340656+JensHauser@users.noreply.github.com>
Co-authored-by: Mitch Bradley <wmb@firmworks.com>
Co-authored-by: JensHauser <jens@hauser-digital.de>

* Clean up -WIP (#801)

* Clean up

* Remove not necessary

Co-authored-by: Luc <luc.@tech-hunters.com>

* External mach def (#807)

* Initial release with custom machine

* initial release

* Wrong addition corrected. AmoutOfToolChanges counts up now.

* pressing Z probe button once is fine, not a second time. reporting not in sequence to function flow

* First working FreeRTOS task with static text. Send "471" every second to all outputs

* Z Probe triggered correctly at button pressed. Can read out all values

* gitignore

* running with state machine, repeatable results in test environment

* works, except that function "user_tool_change" starts the tool change and it will interfer with further g code running in parallel. tbd

* typo

* back to without RTOS.But doesnt move

* RTOS but only with "T1 m06". not with g code program

* hold is better than door

* initial wifi settings

* umlaute

* gitignore

* Fehler bei Limit_Mask

* Spindle_Type angepasst

* lower debounding after adding capacitor

* Revert "lower debounding after adding capacitor"

This reverts commit eadbec2.

* remove customized gitignore

* Revert "remove customized gitignore"

This reverts commit ce44131.

* reduce debounding period due to adding capacitor

* uncomment all tool change source code

* Tets Fräse 2.6 ok

* Fräse 2.6

* Falscher GPIO Pin für Fräse

* test

* Revert "test"

This reverts commit 1265435.

* No Bluetooth necessary

* OTA update (watch Windows firewall!)

* - rename custom machine file name
-added "4axis_xyza.txt" to store Grbl_ESP32 config parameters.
So programming fits to parameters
- added 2 buttons (#1 hold/resume), #2 homing and tool change position

* new Z probe button

* Z probe corretion

* Z probe correction

* Z probe correction

* Fixed Grbl.h

- I think I deleted the GRBL_VERSION line by accident when using the web based conflict editor

* Revert "Merge branch 'Devt' of https://github.com/bdring/Grbl_Esp32 into Devt"

This reverts commit 361558b, reversing
changes made to 811646f.

* Revert "Merge remote-tracking branch 'Grbl_Esp32_JH/master' into Devt"

This reverts commit 811646f, reversing
changes made to a61ab51.

* Add example of external machine def

- This sets some of the important timing parameters.
- Removed redundant example to keep example count down

* Update Grbl.h

Co-authored-by: Jens Hauser <44340656+JensHauser@users.noreply.github.com>
Co-authored-by: Mitch Bradley <wmb@firmworks.com>
Co-authored-by: JensHauser <jens@hauser-digital.de>

* Fix VFD speed change from ISR (#811)

* Motion control calls set_rpm frequently from an ISR. Unfortunately the last change added some debug information in there, which can cause the ESP32 to crash in boundary cases.

* Update Grbl.h

Co-authored-by: Stefan de Bruijn <stefan@nubilosoft.com>
Co-authored-by: bdring <barton.dring@gmail.com>

* Update Grbl.h

Co-authored-by: Stefan de Bruijn <atlaste@users.noreply.github.com>
Co-authored-by: Stefan de Bruijn <stefan@nubilosoft.com>
Co-authored-by: Mitch Bradley <wmb@firmworks.com>
Co-authored-by: Bart Dring <bdring@buildlog.net>
Co-authored-by: odaki <odaki@mars.dti.ne.jp>
Co-authored-by: Pete Wildsmith <pete@weargoggles.co.uk>
Co-authored-by: Luc <8822552+luc-github@users.noreply.github.com>
Co-authored-by: Scott Bezek <scottbez1@gmail.com>
Co-authored-by: Florian Ragwitz <florian.ragwitz@gmail.com>
Co-authored-by: Luc <luc.@tech-hunters.com>
Co-authored-by: Jens Hauser <44340656+JensHauser@users.noreply.github.com>
Co-authored-by: JensHauser <jens@hauser-digital.de>
bdring added a commit that referenced this issue Mar 17, 2021
* Devt (#819)

* Fixed various small bugs (#605)

* Fixed various small bugs

* Fixed potential cast bug

* Fixed double reporting of errors

Co-authored-by: Stefan de Bruijn <stefan@nubilosoft.com>

* Stallguard tuning (#607)

* Devt (#571)

* Handles Tranimic drivers errors better

- If an unsupported driver is specified, it will give a message and not crash.

* Cleaned up unused files

Got rid of old unipolar files
Got rid of servo axis feature - it is a motor class now
Got rid of solenoid pen feature - never really used and it should be a motor class if it is.

* Fix ENABLE_AUTHENTICATION (#569)

* Fixed authentication code.

* Removed another const cast

Co-authored-by: Stefan de Bruijn <stefan@nubilosoft.com>

* Fix step leakage with inverted steps (#570)

* Fix step leakage with inverted steps

* Update build date for merge

Co-authored-by: Bart Dring <bdring@buildlog.net>

Co-authored-by: Stefan de Bruijn <atlaste@users.noreply.github.com>
Co-authored-by: Stefan de Bruijn <stefan@nubilosoft.com>
Co-authored-by: Mitch Bradley <wmb@firmworks.com>
Co-authored-by: Bart Dring <bdring@buildlog.net>

* Update platformio.ini

Per PR 583

* Created an enum for mode

* Removing some unused machine defs

* Added test machine definition

* Clean up for PR

* Remove test machine def.

Co-authored-by: Stefan de Bruijn <atlaste@users.noreply.github.com>
Co-authored-by: Stefan de Bruijn <stefan@nubilosoft.com>
Co-authored-by: Mitch Bradley <wmb@firmworks.com>
Co-authored-by: Bart Dring <bdring@buildlog.net>

* Basic testing Complete

* Made state variable volatile.

* Homing cycle settings (#613)

* Initial Tests Complete

* Update Grbl.h

* Update variables

Co-authored-by: Mitch Bradley <wmb@firmworks.com>

* fixed dual switches when inverted (#614)

* fixed dual switches when inverted

* Removed debug message

* Cleaning up the machine defs

Removed unused #defines.

* Store coordinate offsets in NVS (#611)

* Store coordinate offsets in NVS

* Handle both old Eeprom formats

* Implementing fixes (#616)

- Stop creating additional tasks when limit_init() gets called again from homing and resets
- Explicitly delete an object that was causing a memory loss.

* Update Grbl.h

* Tweak memory fix and add $H check for $Homing/Cycles

* Fix G28.1 and G30.1

* Update Grbl.h

* Homing cycle defaults (#624)

* Changed to add homing cycle defaults

There needs to be a way to set the homing cycle defaults in a machine definition.
There will likely be a better way to do this in the future.

* Update 10vSpindle.cpp

Had wrong error message

* Fixed typos and removed obsolete #defines

* Probe cleanup (#625)

* Cleanup probing code

* Update Grbl.h

* Update after review

* Update error_codes_en_US.csv

* More sd_close() to free memory (#622)

* Changed buffer sizes to 256 throughout various parts of the program. (#626)

This is a patch necessary for F360 personal users, because they decided to add a very lengthy comment...

Co-authored-by: Stefan de Bruijn <stefan@nubilosoft.com>

* $sd/show and handle settings in SD files (#629)

* $sd/show and handle settings in SD files

* Added $LocalFs/Show and fixed $LocalFs/Run output

* Infer / at beginning of SD path name

The LocalFS path processing code already inserts
a / at the beginning of the path is one isn't
present.  This patch does the same for SD files.

* Show $ command responses in WebUI console

* Added $Settings/ListChanged AKA $SC

This is useful for saving settings in a compact form that
leaves defaults unchanged.

* $sd/show works in idle or alarm state

* Apply idle/alarm checks to SPIFFS files too

* Changed sd_close to SD.end()

sd_close was a temporary function to check for memory usage

* Big BUILD_INFO fix (#632)

-- Changes that affect behavior

Fixed the bugs with report_build_info()

Build info is no longer stored in the fixed "EEPROM" section; instead it
is a proper Setting named $Firmware/Build .  You can change it in the
usual way with $Firmware/Build=<whatever>

$I without the = still works.

-- Changes that affect configurability for developers

Converted a couple more #defines into enums - SETTINGS_RESTORE_*
and BITFLAG_RT_STATUS_* .  A side effect of this is that it is
no longer possible to configure the behavior of $RST=* by defining
SETTINGS_RESTORE_ALL to include only a subset.  I think it is
a bad idea from a customer support perspective to have the meaning
of this command be different for different builds.

Changed some of the #define ENABLE_ names to eliminate "EEPROM"

-- Changes that are purely cosmetic

Clarified descriptions in Config.h, to eliminate spurious/incorrect mentions
of "EEPROM"

Eliminated all mentions of the name "EEPROM" except the ones
that truly mean the EEPROM section, as opposed to generalized
non-volatile storage.

The contents of SettingsStorage.h and SettingsStorage.cpp, which
were really related to coordinate storage in Eeprom, not proper
settings, were moved to Eeprom.h and Eeprom.cpp.  The SettingsStorage
files are gone.

Got rid of get_step_pin_mask() and get_direction_pin_mask() because
they were just aliases for bit().  That eliminated some junk from
the SettingsStorage/Eeprom files.  Those files now tightly contain
only the residual stuff related to the storage of coordinate data
in EEPROM.

* Most #defines are gone (#595)

* Many more #defines bite the dust

* Fixed botch in rt accessory logic

* Update Probe.cpp

* Update System.cpp

* Typo

* Fixed WebUI crash (#633)

While eliminating a redundant definition of is_realtime_command(),
I inadvertently introduced a recursion due to the similarity of
the names "is_realtime_command()" and "is_realtime_cmd()".  The
solution is to eliminate the latter entirely.

* Fix i2s probing hang (#608)

* Fix I2S stepper hung just after the completion of motor moving

* Fix recompile issue

Fixed a problem with the recompile not being recompiled even if the files under the Custom folder are changed.

* More comment for macOS in debug.ini

* Fix the timing of calling I2S out's exclusion function and reset sequence

The reset sequence did not seem to be correct, so I changed it.
According to the ESP-IDF PR, the correct sequence is as follows:
1)TX module
2)DMA
3)FIFO
espressif/esp-idf@c7f3352#diff-27688c6b3c29373d2a2b142b8471981c

* Changed the message level for I2S swtiching from warning to debug

* Add some comments

* Implement stepping through Motors class (#636)

* Implement stepping through Motors class

WIP for discussion and review - not ready to merge yet

* Document Motor methods and variables

.. and remove some unused ones and move some
that are subclass-specific

* Move position_min/max to Limits.cpp

... and coalesced other uses thereof into a unified scheme.

* Call motor ->init() explicitly instead of implicitly

This makes it possible to inherit constructors without
spurious config messages.

* Fixed problems with I2S

* Changes in class method override syntax per atlaste

* Fixed oops

* More Motors simplification

a) Eliminated can_home() in favor of a return value from
set_homing_mode()
b) Eliminated axis_name() in favor of reportAxisNameMsg()

* Fixes to RcServo and Trinamic

- RC Servo was not handling disable ... probably old issue
- Display test after config

* More tweaks

* Define that variable!

* Move functions from Motors.cpp to subclasses

Created a Servo base class from which RcServo and
Dynamixel2 are derived.  This gets the servo update
task out of Motors.  It also eliminates the need for
type_id.  Now all of the functions that are specific
to particular kinds of motors are within their subclasses

* Adding Dynamixel to ABC axes.

* Removed second #ifndef SPINDLE_TYPE

* Fixed potential leak in Report.cpp

as reported by @atlaste

* Some servo cleanup. Has errors!

* min should be max

* Removed test rcservo machine definition.

* Removed obsolete #defines in machine defs for RcServo cal

Co-authored-by: bdring <barton.dring@gmail.com>

* Cleaned up AMASS code (#635)

* Cleaned up AMASS code

More #defines gone
74 lines shorter

Tested by comparing the result of original AMASS computation code to
the new code with values surrounding all of the cutoff frequencies.

* I2SOut tick calculation

* Sorted out units for stepper pulse periods

I tried to make it clear what the units are
at different places in the code, and to use
argument datatypes that clearly show the
value range at different points, instead of
relying on implicit type promotion.  Hopefully
this will make it easier to understand when,
where, and why unit conversions occur.

* Update Stepper.h

* Deleted AMASS Config.h option

... as it is no longer optional

* Use less memory (#644)

a) closeFile() now does SD.end() to release memory
after running a file from SD.
b) Several task stacks are smaller
c) All tasks now check their free space if DEBUG_REPORT_STACK_FREE
is defined.  platformio.ini has a commented-out line that can be
uncommented to turn that on.
d) Similarly, platformio.ini can turn on DEBUG_REPORT_HEAP_SIZE
e) Fixed a small leak that occurred when listing local files.

With these changes, the heap size tends to hover around 53K, dropping
to about 37K when running a file from SD.

* Add coolant pin messages to startup (#647)

* Add coolant pin messages to startup

Help with user support.

* Removing incorrect STEPPER_RESET definition

* Fix laser mode startup message

* cleanup

- coolant_init() will behave as before
- update build date
- return default machine to test_drive

* Move CoreXY out of main Grbl (#653)

* Created branch

* WIP

* Update parallel_delta.cpp

* Wip

* WIP

* Wip

* Still working on kinematics

- Added an interface into the jogging section

* WIP

* WIP

* wip

* WIP

* WIP

* Wip

* WIP

* WIP

* Wip

* Update machine defs

* Created branch

* WIP

* Update parallel_delta.cpp

* Wip

* WIP

* Wip

* Still working on kinematics

- Added an interface into the jogging section

* WIP

* WIP

* wip

* WIP

* WIP

* Wip

* WIP

* WIP

* Wip

* Update machine defs

* Machine def change. Moved switches to module 1

* WIP

* Cleanup before P.R.

- Fixed ranges for delta geometry
- Added post homing delay option for servos
- renamed and removed old machine defs.

* Fixing initialization problem when not in USE_KINEMATICS mode

* Fixing Git Mess

* Publishing Branch

- Not ready yet. Issues with Z axis
- Need to add midTbot option

* WIP

- Seems to be fully functional now.
- Need to add midTbot option.

* Update CoreXY.cpp

* I think it is ready for PR

- fixed $RST=#
- added midTbot geometry factor

* Fine tune midtbot definition

* Removed more unneeded corexy code.

* Fixed doubled #define in machine def file.

* Update after review comments

* Added $A AKA Alarms/List command (#654)

* Added $A AKA Alarms/List command

Similar to $E AKA Errors/List

$E used to be AKA ErrorCodes/List

Also added $Errors/Verbose setting to display
full error text instead of the error number.
It defaults to true because it works with every
sender I have tried so far - cncjs, UGS, and Chrome
GCode Sender.  If you have problems with some sender
you can set it to false.

* Added static_assert per atlaste's comment

* Added a default and fixed Authentication issue

Co-authored-by: bdring <barton.dring@gmail.com>

* TMC2130 plotter machine servo config update (#657)

* TMC2130 plotter machine servo config update

based on Slack conversation https://buildlog.slack.com/archives/CBZKZ8LHL/p1604243530253000

* Update Grbl.h

* Trinamic reporting (#656)

* Enhanced reporting of errors

* Change "motor" to "driver" for clarity.

* Added better way to show changed Setting values from Mitch

* Update build date

* Machine Definition Cleanup (#658)

- Removed machine definitions to speed up testing.
- Moved 6 pack CS/MS3 pins with other axis pins to help them stay in sync with the aixs letters

* Spindle delay and Telnet Fix (#676)

* Removed early saving of old state

Was causing later tests to be wrong

* Update Grbl.h

* Update TelnetServer.cpp

Remove filtering of '\r' character.

* ABC Bresenham counter init fix

* Rst responses (#679)

* Added verification of changes from $RST command

When sending $RST=$ you only get these responses.
[MSG:WiFi reset done]
[MSG:BT reset done]
Added the other things that change.
[MSG:WiFi reset done]
[MSG:BT reset done]
[MSG:Settings reset done]
[MSG:Postion offsets reset done]

* Update ProcessSettings.cpp

* Update Grbl.h

* Update ProcessSettings.cpp

* Fix Spindle State broken in earlier PR

* Update Grbl.h

* Spindle and laser (#683)

* WIP

* Updates

* Updates

- Added Laser/FullPower
- Move some stuff from PWM to Laser

* WIP

* Used the stop function before resetiing pins.

* Updates from discussion

- Reset_pins is now deinit()
- VFD task is now deleted when ... deinit()
- Added a Motor/Disable command

* Added Mitch's gambit

* Cleanup

- Finished VFD
- Fixed Settings (Thanks Brian!)
- changed task cores.

* Update VFDSpindle.cpp

* Update Laser.cpp

* Fixing reset

- gpio_reset_pin sets a pullup, which could turn on a device

* Changed Spindle messages to CLIENT_ALL

* Update Grbl.h

* Updates after review

* P.R. Cleanup

* Most spindle settings cause a new init()

* Laser mode (#692)

* Update Machine.h

* spindles now say if in laser mode

* name fix

* Updates

* Getting rid of crosstalk

* Update PWMSpindle.cpp

* Reset some values at spindle init()

* Update SettingsDefinitions.cpp

* Update Grbl.h

* Return to test_drive.h

* User macro button (#685)

* Test Macro Button Idea

* Updates

* Formating

* Changed macro pin reporting to be a single character

* Sd Web UI issues (#698)

* Updates

* returned reportTaskStackSize(uxHighWaterMark);

In a #ifdef DEBUG_TASK_STACK guard

* Disallow web commands unless idle or alarm state

* merging stuff after review

* Handle SD busy state in webserver handler (#697)

* Handle SD busy state in webserver handler

* Update index.html.gz

* Fixed reporting

* Add case for SD not enabled.

* Prevent Web commands except in idle or alarm

* Return authentication to the default

Co-authored-by: Mitch Bradley <wmb@firmworks.com>
Co-authored-by: Luc <8822552+luc-github@users.noreply.github.com>

* Update axis squaring checking (#699)

* Reverting some spindle changes...

CLIENT_ALL caused queue issues

* Rate Adjusting Fix

* Fix SD card hanging on bad gcode

* Fix hang on error 20 from SD/Run (#701)

* Fixed strange WCO values on first load (#702)

When loading Grbl_Esp32 into a fresh ESP32, the WCOs
would often have strange, very large, values.  The problem
was the code that tries to propagate data from the old
"Eeprom" storage format into the new NVS scheme.  The old
format had a broken checksum computation that made the
checksum so weak that if succeeds about half the time on
random data.

The solution is to get rid of all that old code.  The downside
is that migration from a build that uses the old format will
lose the WCO values.  The user will have to reestablish them.
Subsequent updates between different versions that both use
the new NVS format will propagate WCO values correctly.

* Fixes to homing (#706)

* Fixes to homing

* Update Grbl.h

* Clean up after code review.

* Trinamic uart (#700)

* WIP

* WIP

* Updates

* Update Grbl.h

* Removing some test machine definitions

* TMC5160 Drivers were not in tests

* Fix a few issues with VFDSpindle critical error handling (#705)

If a command is critical and fails to receive a response, it should trigger an Alarm. However, because the critical check was only evaluated if the spindle was not already unresponsive, it meant that a critical command failure would be silently ignored if a non-critical command failed before it (putting the VFDSpindle in unresponsive state). Therefore, I've moved the critical check to occur regardless of whether the spindle was already unresponsive.

Second, I believe that setting `sys_rt_exec_alarm` is not sufficient to stop the machine and put it into alarm state. Other alarm conditions (such as hard limits) also run an `mc_reset()` to stop motion first. It appears that without this, motion will not be stopped, and in fact, the alarm appears to get cleared if it occurs during motion!

* Update per P.R. #704 on main

* Update Motors.cpp

* Fix undefined probe reporting if inverted.

* Settings filtering via regular expressions (#717)

* Settings filtering via regular expressions

Implements only the most basic - and the most
useful - special characters - ^$.*

If the search string does not contain a special
character, it is interpreted as before.  Otherwise
the match is either more strict if anchored by
^ or $, or less strict if it contains a . wildcard
or a * repetition.

* Commentary

* Eliminated . metacharacter

* Fix SD/List repetition error (#727)

* Fix SD/List repetition error

The one line change that actually fixes it is
Serial.cpp line 162, where the SD state is compared
to "not busy" instead of "is idle", thus also handling
the "not present" case.

In the process, I converted the "const int SDCARD_ ..."
to an SDState enum class, thus proving type safety and
eliminating yet another untyped uint8_t .

* Updates after testing

Co-authored-by: bdring <barton.dring@gmail.com>

* Fixed RcServo Cals

* PWM fix and simplification (#722)

* PWM fix and simplification

This is an alternative solution to the PWM/ISR/float problem.

1. The set_level() argument is the exact value that is passed
to the LEDC Write function.  It can be interpreted as the
numerator of a rational fraction whose denominator is the
max PWM value, i.e. the precision, == 1 << _resolution_bits

2. There is a new denominator() method that returns the precision.

3. The sys_pwm_control(mask, duty, synchronize) function is
replaced by two functions sys_analog_all_off() and
sys_set_analog(io_num, duty).  This closely matches the
actual usage.  The old routine was called from two places,
one where the mask was alway 0xFF, the duty was always 0,
and synchronize was always false.  That is the one that
was troublesome from ISR context.  The other call always
affected a single pin, so the mask formulation with its
loop was useless extra baggage.  By splitting into two
functions, each one becomes much simpler, thus faster and
easier to understand.  The "synchronize" argument and
associated logic moved out to the caller (GCode.cpp),
which more closely reflects the behavioral logic.

4. For symmetry, sys_io_control() was similarly split.

5. sys_calc_pwm_precision() was moved into UserOutput.cpp
since is it driver specific, not a general system routine.

* Update Grbl.h

* Delete template.h

Co-authored-by: bdring <barton.dring@gmail.com>

* TMC2209 Stallguard (#748)

* TMC2209 Stallguard

- Added StallGuard homing support to TMC2209 (UART)
- Killed off TMC2208 for now. Too many conflicts with TMC2209. Will return with Diamond motor class hierarchy
- Increase StallGuard setting range for TMC2209. Constrianed in each class to actual limits
- Added a machine def to test TMC2209

* Update build date

* Web cmd modes (#754)

* Update System.cpp

* WebCommand with configurable modes

* Added a few more ESP commands to work in anu state

* Update Grbl.h

Co-authored-by: Mitch Bradley <wmb@firmworks.com>

* Updates from PWM_ISR_Fix branch (#755)

- $Message/Level
- ISR safe ledcWrite

* Core XY fixes (#756)

* Updates for CoreXY

* Delete fystec_ant.h

* Parking delay fix (#770)

* Changed delay type

- mc_dwell was causing a recursive loop the overflowed the stack
- See https://discord.com/channels/780079161460916227/786061602754396160/809288050387189782

* Changed spindle delays from floats to ints in spindle classes

- Used local copies, because I did not want to change/break the existing setting.

* Cleaning up parking

- Added a coolant delay setting
- Made an enum class for the dwell types
- Got rid of the safety door sepcific delays

* Update Grbl.h

* Enable per motor fix (#771)

* - moved invert option in front of per motor enables.

* Added code to prevent motors_set_disable() from setting values that already exist.

* Added the enable delay from PR 720

* Adding a defined default for step enable delay

* Fixing feed rates with kinematics and arcs.

- Kinematics changes the feed rate and the loop that creates arc was re-using the altered rate. This caused a runaway situation.

* SD Upload fix by luc (#779)

* Configure motors after I/O pins (#742)

So machine definitions can change the SPI pins before we talk to
any Trinamic drivers.

* 1.0.5 compilation fixes (#782)

* Fix compilations error due to new enum in esp32 core release 1.0.5

* Update Grbl.h

Co-authored-by: Luc <luc.@tech-hunters.com>

* Introduced delays for enable and direction pins (#720)

* Added some timing changes to steppers. Basically this should introduce a small (configurable) delay for enable and direction pins.

* Updates after testing

* Fixed small casting bug

* Fixed subtractions as per @Mitch's comments

* Added STEP_PULSE_DELAY handling for compatibility with RMT_STEPS. Functionality should be unchanged.

* Updates to help merge

Co-authored-by: Stefan de Bruijn <stefan@nubilosoft.com>
Co-authored-by: bdring <barton.dring@gmail.com>

* Vfd and mc_delay issues. Includes VFD sync speed. (#765)

* Added some timing changes to steppers. Basically this should introduce a small (configurable) delay for enable and direction pins.

* Updates after testing

* Fixed small casting bug

* Fixed subtractions as per @Mitch's comments

* Fixed busy flag in Stepper.cpp

* - Changed mc_dwell to double's, because float's have issues with context switches
- Changed spinup/spindown of VFD's to something more sensible
- Implemented advanced wait for spinup/spindown of VFD's

* Changed machine defs

* Implemented spindle speed sync. Made spindle safety polling optional; all the chatter appears to give issues somehow, not sure why.

* Made safety-polling optional.

* Added 'todo' for actual RPM code. Not sure how this should work though.

* Added safety check for unchanged RPM. Changed error output channels.

* Enabled the RPM code.

* Commented out again.

* Changed initialization sequence.
Implemented Huanyang initialization sequence.

* Made some fixes according to our latest insights in the manual

* Fixed docs.

* Fixed another bug in the comments

* Fixed set_speed RPM.

* Fixed huanyang message parsing. Fixed comments.

* Forgot a fall-through return.

* Updated status message after VFD initializes

* Changed output RPM test to output frequency test for sync.

* Changed mc_dwell to milliseconds and made it an integer. Fixed bug with negative values.
Fixed a dwelling bug in the VFD code, which would dwell indefinitely in cases such as safety door.

* Fixed a few small issues during the devt merge. Nothing serious.

* Not having critical initialization makes sense for the collet wrench lock thing (or just VFD's that are powered up later) in the sense that initialization should eventually happen to get the right values. Moreover, when the VFD enters an unresponsive state, re-initialization happens eventually.

* Changed 50 to 5000 for huanyang frequency calc.

* Updates after testing Huanyang

* Ran clang-format. Cleaned up the code a bit.

Co-authored-by: Stefan de Bruijn <stefan@nubilosoft.com>
Co-authored-by: bdring <barton.dring@gmail.com>

* Bug fixes (#790)

* Fix memory leak when answering webcommand (regression issue)

Fix wrong error code on  web command (regression issue)

* Fix sd code not disabled when SD Card feature is disabled

* Use proper error codes / messages

* Update Grbl.h

* Revert "Use proper error codes / messages"

This reverts commit ad49cf8.

* Updated error code symbols and text

- To be generic file system error

Co-authored-by: Luc <luc.@tech-hunters.com>
Co-authored-by: bdring <barton.dring@gmail.com>

* Get next rmt chan num fix (#793)

* Initial release with custom machine

* initial release

* Wrong addition corrected. AmoutOfToolChanges counts up now.

* pressing Z probe button once is fine, not a second time. reporting not in sequence to function flow

* First working FreeRTOS task with static text. Send "471" every second to all outputs

* Z Probe triggered correctly at button pressed. Can read out all values

* gitignore

* running with state machine, repeatable results in test environment

* works, except that function "user_tool_change" starts the tool change and it will interfer with further g code running in parallel. tbd

* typo

* back to without RTOS.But doesnt move

* RTOS but only with "T1 m06". not with g code program

* hold is better than door

* initial wifi settings

* umlaute

* gitignore

* Fehler bei Limit_Mask

* Spindle_Type angepasst

* lower debounding after adding capacitor

* Revert "lower debounding after adding capacitor"

This reverts commit eadbec2.

* remove customized gitignore

* Revert "remove customized gitignore"

This reverts commit ce44131.

* reduce debounding period due to adding capacitor

* uncomment all tool change source code

* Tets Fräse 2.6 ok

* Fräse 2.6

* Falscher GPIO Pin für Fräse

* test

* Revert "test"

This reverts commit 1265435.

* No Bluetooth necessary

* OTA update (watch Windows firewall!)

* - rename custom machine file name
-added "4axis_xyza.txt" to store Grbl_ESP32 config parameters.
So programming fits to parameters
- added 2 buttons (#1 hold/resume), #2 homing and tool change position

* new Z probe button

* Z probe corretion

* Z probe correction

* Z probe correction

* Fixed Grbl.h

- I think I deleted the GRBL_VERSION line by accident when using the web based conflict editor

* Revert "Merge branch 'Devt' of https://github.com/bdring/Grbl_Esp32 into Devt"

This reverts commit 361558b, reversing
changes made to 811646f.

* Revert "Merge remote-tracking branch 'Grbl_Esp32_JH/master' into Devt"

This reverts commit 811646f, reversing
changes made to a61ab51.

* Update

- moved get_next_RMT_chan_num() to constructor
- [Discord discussion](https://discord.com/channels/780079161460916227/786364602223951882/817056437016592384)

Co-authored-by: Jens Hauser <44340656+JensHauser@users.noreply.github.com>
Co-authored-by: Mitch Bradley <wmb@firmworks.com>
Co-authored-by: JensHauser <jens@hauser-digital.de>

* Rc servo updates (#794)

* Initial release with custom machine

* initial release

* Wrong addition corrected. AmoutOfToolChanges counts up now.

* pressing Z probe button once is fine, not a second time. reporting not in sequence to function flow

* First working FreeRTOS task with static text. Send "471" every second to all outputs

* Z Probe triggered correctly at button pressed. Can read out all values

* gitignore

* running with state machine, repeatable results in test environment

* works, except that function "user_tool_change" starts the tool change and it will interfer with further g code running in parallel. tbd

* typo

* back to without RTOS.But doesnt move

* RTOS but only with "T1 m06". not with g code program

* hold is better than door

* initial wifi settings

* umlaute

* gitignore

* Fehler bei Limit_Mask

* Spindle_Type angepasst

* lower debounding after adding capacitor

* Revert "lower debounding after adding capacitor"

This reverts commit eadbec2.

* remove customized gitignore

* Revert "remove customized gitignore"

This reverts commit ce44131.

* reduce debounding period due to adding capacitor

* uncomment all tool change source code

* Tets Fräse 2.6 ok

* Fräse 2.6

* Falscher GPIO Pin für Fräse

* test

* Revert "test"

This reverts commit 1265435.

* No Bluetooth necessary

* OTA update (watch Windows firewall!)

* - rename custom machine file name
-added "4axis_xyza.txt" to store Grbl_ESP32 config parameters.
So programming fits to parameters
- added 2 buttons (#1 hold/resume), #2 homing and tool change position

* new Z probe button

* Z probe corretion

* Z probe correction

* Z probe correction

* Fixed Grbl.h

- I think I deleted the GRBL_VERSION line by accident when using the web based conflict editor

* Revert "Merge branch 'Devt' of https://github.com/bdring/Grbl_Esp32 into Devt"

This reverts commit 361558b, reversing
changes made to 811646f.

* Revert "Merge remote-tracking branch 'Grbl_Esp32_JH/master' into Devt"

This reverts commit 811646f, reversing
changes made to a61ab51.

* RcServo Updates

- Improved disable. It was not always initially set correctly.
- Improved calibration. Now a calibration value greater than 1 moves the motor in a positive direction and a value less than 1 moves it in a negative direction regardless of min/max and direction inverts.

* Update Grbl.h

Update grbl.h

Co-authored-by: Jens Hauser <44340656+JensHauser@users.noreply.github.com>
Co-authored-by: Mitch Bradley <wmb@firmworks.com>
Co-authored-by: JensHauser <jens@hauser-digital.de>

* Motor disable fix (#797)

* Initial release with custom machine

* initial release

* Wrong addition corrected. AmoutOfToolChanges counts up now.

* pressing Z probe button once is fine, not a second time. reporting not in sequence to function flow

* First working FreeRTOS task with static text. Send "471" every second to all outputs

* Z Probe triggered correctly at button pressed. Can read out all values

* gitignore

* running with state machine, repeatable results in test environment

* works, except that function "user_tool_change" starts the tool change and it will interfer with further g code running in parallel. tbd

* typo

* back to without RTOS.But doesnt move

* RTOS but only with "T1 m06". not with g code program

* hold is better than door

* initial wifi settings

* umlaute

* gitignore

* Fehler bei Limit_Mask

* Spindle_Type angepasst

* lower debounding after adding capacitor

* Revert "lower debounding after adding capacitor"

This reverts commit eadbec2.

* remove customized gitignore

* Revert "remove customized gitignore"

This reverts commit ce44131.

* reduce debounding period due to adding capacitor

* uncomment all tool change source code

* Tets Fräse 2.6 ok

* Fräse 2.6

* Falscher GPIO Pin für Fräse

* test

* Revert "test"

This reverts commit 1265435.

* No Bluetooth necessary

* OTA update (watch Windows firewall!)

* - rename custom machine file name
-added "4axis_xyza.txt" to store Grbl_ESP32 config parameters.
So programming fits to parameters
- added 2 buttons (#1 hold/resume), #2 homing and tool change position

* new Z probe button

* Z probe corretion

* Z probe correction

* Z probe correction

* Fixed Grbl.h

- I think I deleted the GRBL_VERSION line by accident when using the web based conflict editor

* Revert "Merge branch 'Devt' of https://github.com/bdring/Grbl_Esp32 into Devt"

This reverts commit 361558b, reversing
changes made to 811646f.

* Revert "Merge remote-tracking branch 'Grbl_Esp32_JH/master' into Devt"

This reverts commit 811646f, reversing
changes made to a61ab51.

* Fixing double invert issue

- On StandardStepper the enable invert was being applied twice. One in Motors.cpp and once in StandardStepper.cpp.

* Update Grbl.h

Co-authored-by: Jens Hauser <44340656+JensHauser@users.noreply.github.com>
Co-authored-by: Mitch Bradley <wmb@firmworks.com>
Co-authored-by: JensHauser <jens@hauser-digital.de>

* Remove doubled settings (#799)

* Initial release with custom machine

* initial release

* Wrong addition corrected. AmoutOfToolChanges counts up now.

* pressing Z probe button once is fine, not a second time. reporting not in sequence to function flow

* First working FreeRTOS task with static text. Send "471" every second to all outputs

* Z Probe triggered correctly at button pressed. Can read out all values

* gitignore

* running with state machine, repeatable results in test environment

* works, except that function "user_tool_change" starts the tool change and it will interfer with further g code running in parallel. tbd

* typo

* back to without RTOS.But doesnt move

* RTOS but only with "T1 m06". not with g code program

* hold is better than door

* initial wifi settings

* umlaute

* gitignore

* Fehler bei Limit_Mask

* Spindle_Type angepasst

* lower debounding after adding capacitor

* Revert "lower debounding after adding capacitor"

This reverts commit eadbec2.

* remove customized gitignore

* Revert "remove customized gitignore"

This reverts commit ce44131.

* reduce debounding period due to adding capacitor

* uncomment all tool change source code

* Tets Fräse 2.6 ok

* Fräse 2.6

* Falscher GPIO Pin für Fräse

* test

* Revert "test"

This reverts commit 1265435.

* No Bluetooth necessary

* OTA update (watch Windows firewall!)

* - rename custom machine file name
-added "4axis_xyza.txt" to store Grbl_ESP32 config parameters.
So programming fits to parameters
- added 2 buttons (#1 hold/resume), #2 homing and tool change position

* new Z probe button

* Z probe corretion

* Z probe correction

* Z probe correction

* Fixed Grbl.h

- I think I deleted the GRBL_VERSION line by accident when using the web based conflict editor

* Revert "Merge branch 'Devt' of https://github.com/bdring/Grbl_Esp32 into Devt"

This reverts commit 361558b, reversing
changes made to 811646f.

* Revert "Merge remote-tracking branch 'Grbl_Esp32_JH/master' into Devt"

This reverts commit 811646f, reversing
changes made to a61ab51.

* Update SettingsDefinitions.cpp

- Double definition of direction_delay_microseconds & enable_delay_microseconds

* Update Grbl.h

Co-authored-by: Jens Hauser <44340656+JensHauser@users.noreply.github.com>
Co-authored-by: Mitch Bradley <wmb@firmworks.com>
Co-authored-by: JensHauser <jens@hauser-digital.de>

* Clean up -WIP (#801)

* Clean up

* Remove not necessary

Co-authored-by: Luc <luc.@tech-hunters.com>

* External mach def (#807)

* Initial release with custom machine

* initial release

* Wrong addition corrected. AmoutOfToolChanges counts up now.

* pressing Z probe button once is fine, not a second time. reporting not in sequence to function flow

* First working FreeRTOS task with static text. Send "471" every second to all outputs

* Z Probe triggered correctly at button pressed. Can read out all values

* gitignore

* running with state machine, repeatable results in test environment

* works, except that function "user_tool_change" starts the tool change and it will interfer with further g code running in parallel. tbd

* typo

* back to without RTOS.But doesnt move

* RTOS but only with "T1 m06". not with g code program

* hold is better than door

* initial wifi settings

* umlaute

* gitignore

* Fehler bei Limit_Mask

* Spindle_Type angepasst

* lower debounding after adding capacitor

* Revert "lower debounding after adding capacitor"

This reverts commit eadbec2.

* remove customized gitignore

* Revert "remove customized gitignore"

This reverts commit ce44131.

* reduce debounding period due to adding capacitor

* uncomment all tool change source code

* Tets Fräse 2.6 ok

* Fräse 2.6

* Falscher GPIO Pin für Fräse

* test

* Revert "test"

This reverts commit 1265435.

* No Bluetooth necessary

* OTA update (watch Windows firewall!)

* - rename custom machine file name
-added "4axis_xyza.txt" to store Grbl_ESP32 config parameters.
So programming fits to parameters
- added 2 buttons (#1 hold/resume), #2 homing and tool change position

* new Z probe button

* Z probe corretion

* Z probe correction

* Z probe correction

* Fixed Grbl.h

- I think I deleted the GRBL_VERSION line by accident when using the web based conflict editor

* Revert "Merge branch 'Devt' of https://github.com/bdring/Grbl_Esp32 into Devt"

This reverts commit 361558b, reversing
changes made to 811646f.

* Revert "Merge remote-tracking branch 'Grbl_Esp32_JH/master' into Devt"

This reverts commit 811646f, reversing
changes made to a61ab51.

* Add example of external machine def

- This sets some of the important timing parameters.
- Removed redundant example to keep example count down

* Update Grbl.h

Co-authored-by: Jens Hauser <44340656+JensHauser@users.noreply.github.com>
Co-authored-by: Mitch Bradley <wmb@firmworks.com>
Co-authored-by: JensHauser <jens@hauser-digital.de>

* Fix VFD speed change from ISR (#811)

* Motion control calls set_rpm frequently from an ISR. Unfortunately the last change added some debug information in there, which can cause the ESP32 to crash in boundary cases.

* Update Grbl.h

Co-authored-by: Stefan de Bruijn <stefan@nubilosoft.com>
Co-authored-by: bdring <barton.dring@gmail.com>

* Update Grbl.h

Co-authored-by: Stefan de Bruijn <atlaste@users.noreply.github.com>
Co-authored-by: Stefan de Bruijn <stefan@nubilosoft.com>
Co-authored-by: Mitch Bradley <wmb@firmworks.com>
Co-authored-by: Bart Dring <bdring@buildlog.net>
Co-authored-by: odaki <odaki@mars.dti.ne.jp>
Co-authored-by: Pete Wildsmith <pete@weargoggles.co.uk>
Co-authored-by: Luc <8822552+luc-github@users.noreply.github.com>
Co-authored-by: Scott Bezek <scottbez1@gmail.com>
Co-authored-by: Florian Ragwitz <florian.ragwitz@gmail.com>
Co-authored-by: Luc <luc.@tech-hunters.com>
Co-authored-by: Jens Hauser <44340656+JensHauser@users.noreply.github.com>
Co-authored-by: JensHauser <jens@hauser-digital.de>

* changing  to EXTENDED type from GRBL type to prevent sender issues when running 1585

Co-authored-by: bdring <barton.dring@gmail.com>
Co-authored-by: Stefan de Bruijn <atlaste@users.noreply.github.com>
Co-authored-by: Stefan de Bruijn <stefan@nubilosoft.com>
Co-authored-by: Mitch Bradley <wmb@firmworks.com>
Co-authored-by: Bart Dring <bdring@buildlog.net>
Co-authored-by: odaki <odaki@mars.dti.ne.jp>
Co-authored-by: Pete Wildsmith <pete@weargoggles.co.uk>
Co-authored-by: Luc <8822552+luc-github@users.noreply.github.com>
Co-authored-by: Scott Bezek <scottbez1@gmail.com>
Co-authored-by: Florian Ragwitz <florian.ragwitz@gmail.com>
Co-authored-by: Luc <luc.@tech-hunters.com>
Co-authored-by: Jens Hauser <44340656+JensHauser@users.noreply.github.com>
Co-authored-by: JensHauser <jens@hauser-digital.de>
Co-authored-by: me <me_xeon_wsl_ubuntu18@brng.us>
bdring added a commit that referenced this issue Mar 17, 2021
* Fixed various small bugs (#605)

* Fixed various small bugs

* Fixed potential cast bug

* Fixed double reporting of errors

Co-authored-by: Stefan de Bruijn <stefan@nubilosoft.com>

* Stallguard tuning (#607)

* Devt (#571)

* Handles Tranimic drivers errors better

- If an unsupported driver is specified, it will give a message and not crash.

* Cleaned up unused files

Got rid of old unipolar files
Got rid of servo axis feature - it is a motor class now
Got rid of solenoid pen feature - never really used and it should be a motor class if it is.

* Fix ENABLE_AUTHENTICATION (#569)

* Fixed authentication code.

* Removed another const cast

Co-authored-by: Stefan de Bruijn <stefan@nubilosoft.com>

* Fix step leakage with inverted steps (#570)

* Fix step leakage with inverted steps

* Update build date for merge

Co-authored-by: Bart Dring <bdring@buildlog.net>

Co-authored-by: Stefan de Bruijn <atlaste@users.noreply.github.com>
Co-authored-by: Stefan de Bruijn <stefan@nubilosoft.com>
Co-authored-by: Mitch Bradley <wmb@firmworks.com>
Co-authored-by: Bart Dring <bdring@buildlog.net>

* Update platformio.ini

Per PR 583

* Created an enum for mode

* Removing some unused machine defs

* Added test machine definition

* Clean up for PR

* Remove test machine def.

Co-authored-by: Stefan de Bruijn <atlaste@users.noreply.github.com>
Co-authored-by: Stefan de Bruijn <stefan@nubilosoft.com>
Co-authored-by: Mitch Bradley <wmb@firmworks.com>
Co-authored-by: Bart Dring <bdring@buildlog.net>

* Basic testing Complete

* Made state variable volatile.

* Homing cycle settings (#613)

* Initial Tests Complete

* Update Grbl.h

* Update variables

Co-authored-by: Mitch Bradley <wmb@firmworks.com>

* fixed dual switches when inverted (#614)

* fixed dual switches when inverted

* Removed debug message

* Cleaning up the machine defs

Removed unused #defines.

* Store coordinate offsets in NVS (#611)

* Store coordinate offsets in NVS

* Handle both old Eeprom formats

* Implementing fixes (#616)

- Stop creating additional tasks when limit_init() gets called again from homing and resets
- Explicitly delete an object that was causing a memory loss.

* Update Grbl.h

* Tweak memory fix and add $H check for $Homing/Cycles

* Fix G28.1 and G30.1

* Update Grbl.h

* Homing cycle defaults (#624)

* Changed to add homing cycle defaults

There needs to be a way to set the homing cycle defaults in a machine definition.
There will likely be a better way to do this in the future.

* Update 10vSpindle.cpp

Had wrong error message

* Fixed typos and removed obsolete #defines

* Probe cleanup (#625)

* Cleanup probing code

* Update Grbl.h

* Update after review

* Update error_codes_en_US.csv

* More sd_close() to free memory (#622)

* Changed buffer sizes to 256 throughout various parts of the program. (#626)

This is a patch necessary for F360 personal users, because they decided to add a very lengthy comment...

Co-authored-by: Stefan de Bruijn <stefan@nubilosoft.com>

* $sd/show and handle settings in SD files (#629)

* $sd/show and handle settings in SD files

* Added $LocalFs/Show and fixed $LocalFs/Run output

* Infer / at beginning of SD path name

The LocalFS path processing code already inserts
a / at the beginning of the path is one isn't
present.  This patch does the same for SD files.

* Show $ command responses in WebUI console

* Added $Settings/ListChanged AKA $SC

This is useful for saving settings in a compact form that
leaves defaults unchanged.

* $sd/show works in idle or alarm state

* Apply idle/alarm checks to SPIFFS files too

* Changed sd_close to SD.end()

sd_close was a temporary function to check for memory usage

* Big BUILD_INFO fix (#632)

-- Changes that affect behavior

Fixed the bugs with report_build_info()

Build info is no longer stored in the fixed "EEPROM" section; instead it
is a proper Setting named $Firmware/Build .  You can change it in the
usual way with $Firmware/Build=<whatever>

$I without the = still works.

-- Changes that affect configurability for developers

Converted a couple more #defines into enums - SETTINGS_RESTORE_*
and BITFLAG_RT_STATUS_* .  A side effect of this is that it is
no longer possible to configure the behavior of $RST=* by defining
SETTINGS_RESTORE_ALL to include only a subset.  I think it is
a bad idea from a customer support perspective to have the meaning
of this command be different for different builds.

Changed some of the #define ENABLE_ names to eliminate "EEPROM"

-- Changes that are purely cosmetic

Clarified descriptions in Config.h, to eliminate spurious/incorrect mentions
of "EEPROM"

Eliminated all mentions of the name "EEPROM" except the ones
that truly mean the EEPROM section, as opposed to generalized
non-volatile storage.

The contents of SettingsStorage.h and SettingsStorage.cpp, which
were really related to coordinate storage in Eeprom, not proper
settings, were moved to Eeprom.h and Eeprom.cpp.  The SettingsStorage
files are gone.

Got rid of get_step_pin_mask() and get_direction_pin_mask() because
they were just aliases for bit().  That eliminated some junk from
the SettingsStorage/Eeprom files.  Those files now tightly contain
only the residual stuff related to the storage of coordinate data
in EEPROM.

* Most #defines are gone (#595)

* Many more #defines bite the dust

* Fixed botch in rt accessory logic

* Update Probe.cpp

* Update System.cpp

* Typo

* Fixed WebUI crash (#633)

While eliminating a redundant definition of is_realtime_command(),
I inadvertently introduced a recursion due to the similarity of
the names "is_realtime_command()" and "is_realtime_cmd()".  The
solution is to eliminate the latter entirely.

* Fix i2s probing hang (#608)

* Fix I2S stepper hung just after the completion of motor moving

* Fix recompile issue

Fixed a problem with the recompile not being recompiled even if the files under the Custom folder are changed.

* More comment for macOS in debug.ini

* Fix the timing of calling I2S out's exclusion function and reset sequence

The reset sequence did not seem to be correct, so I changed it.
According to the ESP-IDF PR, the correct sequence is as follows:
1)TX module
2)DMA
3)FIFO
https://github.com/espressif/esp-idf/commit/c7f33524b469e75937f003d4c06336bf4694a043#diff-27688c6b3c29373d2a2b142b8471981c

* Changed the message level for I2S swtiching from warning to debug

* Add some comments

* Implement stepping through Motors class (#636)

* Implement stepping through Motors class

WIP for discussion and review - not ready to merge yet

* Document Motor methods and variables

.. and remove some unused ones and move some
that are subclass-specific

* Move position_min/max to Limits.cpp

... and coalesced other uses thereof into a unified scheme.

* Call motor ->init() explicitly instead of implicitly

This makes it possible to inherit constructors without
spurious config messages.

* Fixed problems with I2S

* Changes in class method override syntax per atlaste

* Fixed oops

* More Motors simplification

a) Eliminated can_home() in favor of a return value from
set_homing_mode()
b) Eliminated axis_name() in favor of reportAxisNameMsg()

* Fixes to RcServo and Trinamic

- RC Servo was not handling disable ... probably old issue
- Display test after config

* More tweaks

* Define that variable!

* Move functions from Motors.cpp to subclasses

Created a Servo base class from which RcServo and
Dynamixel2 are derived.  This gets the servo update
task out of Motors.  It also eliminates the need for
type_id.  Now all of the functions that are specific
to particular kinds of motors are within their subclasses

* Adding Dynamixel to ABC axes.

* Removed second #ifndef SPINDLE_TYPE

* Fixed potential leak in Report.cpp

as reported by @atlaste

* Some servo cleanup. Has errors!

* min should be max

* Removed test rcservo machine definition.

* Removed obsolete #defines in machine defs for RcServo cal

Co-authored-by: bdring <barton.dring@gmail.com>

* Cleaned up AMASS code (#635)

* Cleaned up AMASS code

More #defines gone
74 lines shorter

Tested by comparing the result of original AMASS computation code to
the new code with values surrounding all of the cutoff frequencies.

* I2SOut tick calculation

* Sorted out units for stepper pulse periods

I tried to make it clear what the units are
at different places in the code, and to use
argument datatypes that clearly show the
value range at different points, instead of
relying on implicit type promotion.  Hopefully
this will make it easier to understand when,
where, and why unit conversions occur.

* Update Stepper.h

* Deleted AMASS Config.h option

... as it is no longer optional

* Use less memory (#644)

a) closeFile() now does SD.end() to release memory
after running a file from SD.
b) Several task stacks are smaller
c) All tasks now check their free space if DEBUG_REPORT_STACK_FREE
is defined.  platformio.ini has a commented-out line that can be
uncommented to turn that on.
d) Similarly, platformio.ini can turn on DEBUG_REPORT_HEAP_SIZE
e) Fixed a small leak that occurred when listing local files.

With these changes, the heap size tends to hover around 53K, dropping
to about 37K when running a file from SD.

* Add coolant pin messages to startup (#647)

* Add coolant pin messages to startup

Help with user support.

* Removing incorrect STEPPER_RESET definition

* Fix laser mode startup message

* cleanup

- coolant_init() will behave as before
- update build date
- return default machine to test_drive

* Move CoreXY out of main Grbl (#653)

* Created branch

* WIP

* Update parallel_delta.cpp

* Wip

* WIP

* Wip

* Still working on kinematics

- Added an interface into the jogging section

* WIP

* WIP

* wip

* WIP

* WIP

* Wip

* WIP

* WIP

* Wip

* Update machine defs

* Created branch

* WIP

* Update parallel_delta.cpp

* Wip

* WIP

* Wip

* Still working on kinematics

- Added an interface into the jogging section

* WIP

* WIP

* wip

* WIP

* WIP

* Wip

* WIP

* WIP

* Wip

* Update machine defs

* Machine def change. Moved switches to module 1

* WIP

* Cleanup before P.R.

- Fixed ranges for delta geometry
- Added post homing delay option for servos
- renamed and removed old machine defs.

* Fixing initialization problem when not in USE_KINEMATICS mode

* Fixing Git Mess

* Publishing Branch

- Not ready yet. Issues with Z axis
- Need to add midTbot option

* WIP

- Seems to be fully functional now.
- Need to add midTbot option.

* Update CoreXY.cpp

* I think it is ready for PR

- fixed $RST=#
- added midTbot geometry factor

* Fine tune midtbot definition

* Removed more unneeded corexy code.

* Fixed doubled #define in machine def file.

* Update after review comments

* Added $A AKA Alarms/List command (#654)

* Added $A AKA Alarms/List command

Similar to $E AKA Errors/List

$E used to be AKA ErrorCodes/List

Also added $Errors/Verbose setting to display
full error text instead of the error number.
It defaults to true because it works with every
sender I have tried so far - cncjs, UGS, and Chrome
GCode Sender.  If you have problems with some sender
you can set it to false.

* Added static_assert per atlaste's comment

* Added a default and fixed Authentication issue

Co-authored-by: bdring <barton.dring@gmail.com>

* TMC2130 plotter machine servo config update (#657)

* TMC2130 plotter machine servo config update

based on Slack conversation https://buildlog.slack.com/archives/CBZKZ8LHL/p1604243530253000

* Update Grbl.h

* Trinamic reporting (#656)

* Enhanced reporting of errors

* Change "motor" to "driver" for clarity.

* Added better way to show changed Setting values from Mitch

* Update build date

* Machine Definition Cleanup (#658)

- Removed machine definitions to speed up testing.
- Moved 6 pack CS/MS3 pins with other axis pins to help them stay in sync with the aixs letters

* Spindle delay and Telnet Fix (#676)

* Removed early saving of old state

Was causing later tests to be wrong

* Update Grbl.h

* Update TelnetServer.cpp

Remove filtering of '\r' character.

* ABC Bresenham counter init fix

* Rst responses (#679)

* Added verification of changes from $RST command

When sending $RST=$ you only get these responses.
[MSG:WiFi reset done]
[MSG:BT reset done]
Added the other things that change.
[MSG:WiFi reset done]
[MSG:BT reset done]
[MSG:Settings reset done]
[MSG:Postion offsets reset done]

* Update ProcessSettings.cpp

* Update Grbl.h

* Update ProcessSettings.cpp

* Fix Spindle State broken in earlier PR

* Update Grbl.h

* Spindle and laser (#683)

* WIP

* Updates

* Updates

- Added Laser/FullPower
- Move some stuff from PWM to Laser

* WIP

* Used the stop function before resetiing pins.

* Updates from discussion

- Reset_pins is now deinit()
- VFD task is now deleted when ... deinit()
- Added a Motor/Disable command

* Added Mitch's gambit

* Cleanup

- Finished VFD
- Fixed Settings (Thanks Brian!)
- changed task cores.

* Update VFDSpindle.cpp

* Update Laser.cpp

* Fixing reset

- gpio_reset_pin sets a pullup, which could turn on a device

* Changed Spindle messages to CLIENT_ALL

* Update Grbl.h

* Updates after review

* P.R. Cleanup

* Most spindle settings cause a new init()

* Laser mode (#692)

* Update Machine.h

* spindles now say if in laser mode

* name fix

* Updates

* Getting rid of crosstalk

* Update PWMSpindle.cpp

* Reset some values at spindle init()

* Update SettingsDefinitions.cpp

* Update Grbl.h

* Return to test_drive.h

* User macro button (#685)

* Test Macro Button Idea

* Updates

* Formating

* Changed macro pin reporting to be a single character

* Sd Web UI issues (#698)

* Updates

* returned reportTaskStackSize(uxHighWaterMark);

In a #ifdef DEBUG_TASK_STACK guard

* Disallow web commands unless idle or alarm state

* merging stuff after review

* Handle SD busy state in webserver handler (#697)

* Handle SD busy state in webserver handler

* Update index.html.gz

* Fixed reporting

* Add case for SD not enabled.

* Prevent Web commands except in idle or alarm

* Return authentication to the default

Co-authored-by: Mitch Bradley <wmb@firmworks.com>
Co-authored-by: Luc <8822552+luc-github@users.noreply.github.com>

* Update axis squaring checking (#699)

* Reverting some spindle changes...

CLIENT_ALL caused queue issues

* Rate Adjusting Fix

* Fix SD card hanging on bad gcode

* Fix hang on error 20 from SD/Run (#701)

* Fixed strange WCO values on first load (#702)

When loading Grbl_Esp32 into a fresh ESP32, the WCOs
would often have strange, very large, values.  The problem
was the code that tries to propagate data from the old
"Eeprom" storage format into the new NVS scheme.  The old
format had a broken checksum computation that made the
checksum so weak that if succeeds about half the time on
random data.

The solution is to get rid of all that old code.  The downside
is that migration from a build that uses the old format will
lose the WCO values.  The user will have to reestablish them.
Subsequent updates between different versions that both use
the new NVS format will propagate WCO values correctly.

* Fixes to homing (#706)

* Fixes to homing

* Update Grbl.h

* Clean up after code review.

* Trinamic uart (#700)

* WIP

* WIP

* Updates

* Update Grbl.h

* Removing some test machine definitions

* TMC5160 Drivers were not in tests

* Fix a few issues with VFDSpindle critical error handling (#705)

If a command is critical and fails to receive a response, it should trigger an Alarm. However, because the critical check was only evaluated if the spindle was not already unresponsive, it meant that a critical command failure would be silently ignored if a non-critical command failed before it (putting the VFDSpindle in unresponsive state). Therefore, I've moved the critical check to occur regardless of whether the spindle was already unresponsive.

Second, I believe that setting `sys_rt_exec_alarm` is not sufficient to stop the machine and put it into alarm state. Other alarm conditions (such as hard limits) also run an `mc_reset()` to stop motion first. It appears that without this, motion will not be stopped, and in fact, the alarm appears to get cleared if it occurs during motion!

* Update per P.R. #704 on main

* Update Motors.cpp

* Fix undefined probe reporting if inverted.

* Settings filtering via regular expressions (#717)

* Settings filtering via regular expressions

Implements only the most basic - and the most
useful - special characters - ^$.*

If the search string does not contain a special
character, it is interpreted as before.  Otherwise
the match is either more strict if anchored by
^ or $, or less strict if it contains a . wildcard
or a * repetition.

* Commentary

* Eliminated . metacharacter

* Fix SD/List repetition error (#727)

* Fix SD/List repetition error

The one line change that actually fixes it is
Serial.cpp line 162, where the SD state is compared
to "not busy" instead of "is idle", thus also handling
the "not present" case.

In the process, I converted the "const int SDCARD_ ..."
to an SDState enum class, thus proving type safety and
eliminating yet another untyped uint8_t .

* Updates after testing

Co-authored-by: bdring <barton.dring@gmail.com>

* Fixed RcServo Cals

* PWM fix and simplification (#722)

* PWM fix and simplification

This is an alternative solution to the PWM/ISR/float problem.

1. The set_level() argument is the exact value that is passed
to the LEDC Write function.  It can be interpreted as the
numerator of a rational fraction whose denominator is the
max PWM value, i.e. the precision, == 1 << _resolution_bits

2. There is a new denominator() method that returns the precision.

3. The sys_pwm_control(mask, duty, synchronize) function is
replaced by two functions sys_analog_all_off() and
sys_set_analog(io_num, duty).  This closely matches the
actual usage.  The old routine was called from two places,
one where the mask was alway 0xFF, the duty was always 0,
and synchronize was always false.  That is the one that
was troublesome from ISR context.  The other call always
affected a single pin, so the mask formulation with its
loop was useless extra baggage.  By splitting into two
functions, each one becomes much simpler, thus faster and
easier to understand.  The "synchronize" argument and
associated logic moved out to the caller (GCode.cpp),
which more closely reflects the behavioral logic.

4. For symmetry, sys_io_control() was similarly split.

5. sys_calc_pwm_precision() was moved into UserOutput.cpp
since is it driver specific, not a general system routine.

* Update Grbl.h

* Delete template.h

Co-authored-by: bdring <barton.dring@gmail.com>

* TMC2209 Stallguard (#748)

* TMC2209 Stallguard

- Added StallGuard homing support to TMC2209 (UART)
- Killed off TMC2208 for now. Too many conflicts with TMC2209. Will return with Diamond motor class hierarchy
- Increase StallGuard setting range for TMC2209. Constrianed in each class to actual limits
- Added a machine def to test TMC2209

* Update build date

* Web cmd modes (#754)

* Update System.cpp

* WebCommand with configurable modes

* Added a few more ESP commands to work in anu state

* Update Grbl.h

Co-authored-by: Mitch Bradley <wmb@firmworks.com>

* Updates from PWM_ISR_Fix branch (#755)

- $Message/Level
- ISR safe ledcWrite

* Core XY fixes (#756)

* Updates for CoreXY

* Delete fystec_ant.h

* Parking delay fix (#770)

* Changed delay type

- mc_dwell was causing a recursive loop the overflowed the stack
- See https://discord.com/channels/780079161460916227/786061602754396160/809288050387189782

* Changed spindle delays from floats to ints in spindle classes

- Used local copies, because I did not want to change/break the existing setting.

* Cleaning up parking

- Added a coolant delay setting
- Made an enum class for the dwell types
- Got rid of the safety door sepcific delays

* Update Grbl.h

* Enable per motor fix (#771)

* - moved invert option in front of per motor enables.

* Added code to prevent motors_set_disable() from setting values that already exist.

* Added the enable delay from PR 720

* Adding a defined default for step enable delay

* Fixing feed rates with kinematics and arcs.

- Kinematics changes the feed rate and the loop that creates arc was re-using the altered rate. This caused a runaway situation.

* SD Upload fix by luc (#779)

* Configure motors after I/O pins (#742)

So machine definitions can change the SPI pins before we talk to
any Trinamic drivers.

* 1.0.5 compilation fixes (#782)

* Fix compilations error due to new enum in esp32 core release 1.0.5

* Update Grbl.h

Co-authored-by: Luc <luc.@tech-hunters.com>

* Introduced delays for enable and direction pins (#720)

* Added some timing changes to steppers. Basically this should introduce a small (configurable) delay for enable and direction pins.

* Updates after testing

* Fixed small casting bug

* Fixed subtractions as per @Mitch's comments

* Added STEP_PULSE_DELAY handling for compatibility with RMT_STEPS. Functionality should be unchanged.

* Updates to help merge

Co-authored-by: Stefan de Bruijn <stefan@nubilosoft.com>
Co-authored-by: bdring <barton.dring@gmail.com>

* Vfd and mc_delay issues. Includes VFD sync speed. (#765)

* Added some timing changes to steppers. Basically this should introduce a small (configurable) delay for enable and direction pins.

* Updates after testing

* Fixed small casting bug

* Fixed subtractions as per @Mitch's comments

* Fixed busy flag in Stepper.cpp

* - Changed mc_dwell to double's, because float's have issues with context switches
- Changed spinup/spindown of VFD's to something more sensible
- Implemented advanced wait for spinup/spindown of VFD's

* Changed machine defs

* Implemented spindle speed sync. Made spindle safety polling optional; all the chatter appears to give issues somehow, not sure why.

* Made safety-polling optional.

* Added 'todo' for actual RPM code. Not sure how this should work though.

* Added safety check for unchanged RPM. Changed error output channels.

* Enabled the RPM code.

* Commented out again.

* Changed initialization sequence.
Implemented Huanyang initialization sequence.

* Made some fixes according to our latest insights in the manual

* Fixed docs.

* Fixed another bug in the comments

* Fixed set_speed RPM.

* Fixed huanyang message parsing. Fixed comments.

* Forgot a fall-through return.

* Updated status message after VFD initializes

* Changed output RPM test to output frequency test for sync.

* Changed mc_dwell to milliseconds and made it an integer. Fixed bug with negative values.
Fixed a dwelling bug in the VFD code, which would dwell indefinitely in cases such as safety door.

* Fixed a few small issues during the devt merge. Nothing serious.

* Not having critical initialization makes sense for the collet wrench lock thing (or just VFD's that are powered up later) in the sense that initialization should eventually happen to get the right values. Moreover, when the VFD enters an unresponsive state, re-initialization happens eventually.

* Changed 50 to 5000 for huanyang frequency calc.

* Updates after testing Huanyang

* Ran clang-format. Cleaned up the code a bit.

Co-authored-by: Stefan de Bruijn <stefan@nubilosoft.com>
Co-authored-by: bdring <barton.dring@gmail.com>

* Bug fixes (#790)

* Fix memory leak when answering webcommand (regression issue)

Fix wrong error code on  web command (regression issue)

* Fix sd code not disabled when SD Card feature is disabled

* Use proper error codes / messages

* Update Grbl.h

* Revert "Use proper error codes / messages"

This reverts commit ad49cf8cc1cb2064a8f7687cb4c354eba4bc8172.

* Updated error code symbols and text

- To be generic file system error

Co-authored-by: Luc <luc.@tech-hunters.com>
Co-authored-by: bdring <barton.dring@gmail.com>

* Get next rmt chan num fix (#793)

* Initial release with custom machine

* initial release

* Wrong addition corrected. AmoutOfToolChanges counts up now.

* pressing Z probe button once is fine, not a second time. reporting not in sequence to function flow

* First working FreeRTOS task with static text. Send "471" every second to all outputs

* Z Probe triggered correctly at button pressed. Can read out all values

* gitignore

* running with state machine, repeatable results in test environment

* works, except that function "user_tool_change" starts the tool change and it will interfer with further g code running in parallel. tbd

* typo

* back to without RTOS.But doesnt move

* RTOS but only with "T1 m06". not with g code program

* hold is better than door

* initial wifi settings

* umlaute

* gitignore

* Fehler bei Limit_Mask

* Spindle_Type angepasst

* lower debounding after adding capacitor

* Revert "lower debounding after adding capacitor"

This reverts commit eadbec23596bf6b46ec750a5ae519e8f1893876e.

* remove customized gitignore

* Revert "remove customized gitignore"

This reverts commit ce44131c7afdb53964067073e4a52ab8e3fe8f4b.

* reduce debounding period due to adding capacitor

* uncomment all tool change source code

* Tets Fräse 2.6 ok

* Fräse 2.6

* Falscher GPIO Pin für Fräse

* test

* Revert "test"

This reverts commit 1265435786eb327226553c5178f942cd96f08888.

* No Bluetooth necessary

* OTA update (watch Windows firewall!)

* - rename custom machine file name
-added "4axis_xyza.txt" to store Grbl_ESP32 config parameters.
So programming fits to parameters
- added 2 buttons (#1 hold/resume), #2 homing and tool change position

* new Z probe button

* Z probe corretion

* Z probe correction

* Z probe correction

* Fixed Grbl.h

- I think I deleted the GRBL_VERSION line by accident when using the web based conflict editor

* Revert "Merge branch 'Devt' of https://github.com/bdring/Grbl_Esp32 into Devt"

This reverts commit 361558b6b74f1ab6ae60fa250207081b941f6c20, reversing
changes made to 811646f5e77ce838082ee3c89a5ea99aa6ef9fd5.

* Revert "Merge remote-tracking branch 'Grbl_Esp32_JH/master' into Devt"

This reverts commit 811646f5e77ce838082ee3c89a5ea99aa6ef9fd5, reversing
changes made to a61ab51c0bab36195644f7438dc82e84af32a5a9.

* Update

- moved get_next_RMT_chan_num() to constructor
- [Discord discussion](https://discord.com/channels/780079161460916227/786364602223951882/817056437016592384)

Co-authored-by: Jens Hauser <44340656+JensHauser@users.noreply.github.com>
Co-authored-by: Mitch Bradley <wmb@firmworks.com>
Co-authored-by: JensHauser <jens@hauser-digital.de>

* Rc servo updates (#794)

* Initial release with custom machine

* initial release

* Wrong addition corrected. AmoutOfToolChanges counts up now.

* pressing Z probe button once is fine, not a second time. reporting not in sequence to function flow

* First working FreeRTOS task with static text. Send "471" every second to all outputs

* Z Probe triggered correctly at button pressed. Can read out all values

* gitignore

* running with state machine, repeatable results in test environment

* works, except that function "user_tool_change" starts the tool change and it will interfer with further g code running in parallel. tbd

* typo

* back to without RTOS.But doesnt move

* RTOS but only with "T1 m06". not with g code program

* hold is better than door

* initial wifi settings

* umlaute

* gitignore

* Fehler bei Limit_Mask

* Spindle_Type angepasst

* lower debounding after adding capacitor

* Revert "lower debounding after adding capacitor"

This reverts commit eadbec23596bf6b46ec750a5ae519e8f1893876e.

* remove customized gitignore

* Revert "remove customized gitignore"

This reverts commit ce44131c7afdb53964067073e4a52ab8e3fe8f4b.

* reduce debounding period due to adding capacitor

* uncomment all tool change source code

* Tets Fräse 2.6 ok

* Fräse 2.6

* Falscher GPIO Pin für Fräse

* test

* Revert "test"

This reverts commit 1265435786eb327226553c5178f942cd96f08888.

* No Bluetooth necessary

* OTA update (watch Windows firewall!)

* - rename custom machine file name
-added "4axis_xyza.txt" to store Grbl_ESP32 config parameters.
So programming fits to parameters
- added 2 buttons (#1 hold/resume), #2 homing and tool change position

* new Z probe button

* Z probe corretion

* Z probe correction

* Z probe correction

* Fixed Grbl.h

- I think I deleted the GRBL_VERSION line by accident when using the web based conflict editor

* Revert "Merge branch 'Devt' of https://github.com/bdring/Grbl_Esp32 into Devt"

This reverts commit 361558b6b74f1ab6ae60fa250207081b941f6c20, reversing
changes made to 811646f5e77ce838082ee3c89a5ea99aa6ef9fd5.

* Revert "Merge remote-tracking branch 'Grbl_Esp32_JH/master' into Devt"

This reverts commit 811646f5e77ce838082ee3c89a5ea99aa6ef9fd5, reversing
changes made to a61ab51c0bab36195644f7438dc82e84af32a5a9.

* RcServo Updates

- Improved disable. It was not always initially set correctly.
- Improved calibration. Now a calibration value greater than 1 moves the motor in a positive direction and a value less than 1 moves it in a negative direction regardless of min/max and direction inverts.

* Update Grbl.h

Update grbl.h

Co-authored-by: Jens Hauser <44340656+JensHauser@users.noreply.github.com>
Co-authored-by: Mitch Bradley <wmb@firmworks.com>
Co-authored-by: JensHauser <jens@hauser-digital.de>

* Motor disable fix (#797)

* Initial release with custom machine

* initial release

* Wrong addition corrected. AmoutOfToolChanges counts up now.

* pressing Z probe button once is fine, not a second time. reporting not in sequence to function flow

* First working FreeRTOS task with static text. Send "471" every second to all outputs

* Z Probe triggered correctly at button pressed. Can read out all values

* gitignore

* running with state machine, repeatable results in test environment

* works, except that function "user_tool_change" starts the tool change and it will interfer with further g code running in parallel. tbd

* typo

* back to without RTOS.But doesnt move

* RTOS but only with "T1 m06". not with g code program

* hold is better than door

* initial wifi settings

* umlaute

* gitignore

* Fehler bei Limit_Mask

* Spindle_Type angepasst

* lower debounding after adding capacitor

* Revert "lower debounding after adding capacitor"

This reverts commit eadbec23596bf6b46ec750a5ae519e8f1893876e.

* remove customized gitignore

* Revert "remove customized gitignore"

This reverts commit ce44131c7afdb53964067073e4a52ab8e3fe8f4b.

* reduce debounding period due to adding capacitor

* uncomment all tool change source code

* Tets Fräse 2.6 ok

* Fräse 2.6

* Falscher GPIO Pin für Fräse

* test

* Revert "test"

This reverts commit 1265435786eb327226553c5178f942cd96f08888.

* No Bluetooth necessary

* OTA update (watch Windows firewall!)

* - rename custom machine file name
-added "4axis_xyza.txt" to store Grbl_ESP32 config parameters.
So programming fits to parameters
- added 2 buttons (#1 hold/resume), #2 homing and tool change position

* new Z probe button

* Z probe corretion

* Z probe correction

* Z probe correction

* Fixed Grbl.h

- I think I deleted the GRBL_VERSION line by accident when using the web based conflict editor

* Revert "Merge branch 'Devt' of https://github.com/bdring/Grbl_Esp32 into Devt"

This reverts commit 361558b6b74f1ab6ae60fa250207081b941f6c20, reversing
changes made to 811646f5e77ce838082ee3c89a5ea99aa6ef9fd5.

* Revert "Merge remote-tracking branch 'Grbl_Esp32_JH/master' into Devt"

This reverts commit 811646f5e77ce838082ee3c89a5ea99aa6ef9fd5, reversing
changes made to a61ab51c0bab36195644f7438dc82e84af32a5a9.

* Fixing double invert issue

- On StandardStepper the enable invert was being applied twice. One in Motors.cpp and once in StandardStepper.cpp.

* Update Grbl.h

Co-authored-by: Jens Hauser <44340656+JensHauser@users.noreply.github.com>
Co-authored-by: Mitch Bradley <wmb@firmworks.com>
Co-authored-by: JensHauser <jens@hauser-digital.de>

* Remove doubled settings (#799)

* Initial release with custom machine

* initial release

* Wrong addition corrected. AmoutOfToolChanges counts up now.

* pressing Z probe button once is fine, not a second time. reporting not in sequence to function flow

* First working FreeRTOS task with static text. Send "471" every second to all outputs

* Z Probe triggered correctly at button pressed. Can read out all values

* gitignore

* running with state machine, repeatable results in test environment

* works, except that function "user_tool_change" starts the tool change and it will interfer with further g code running in parallel. tbd

* typo

* back to without RTOS.But doesnt move

* RTOS but only with "T1 m06". not with g code program

* hold is better than door

* initial wifi settings

* umlaute

* gitignore

* Fehler bei Limit_Mask

* Spindle_Type angepasst

* lower debounding after adding capacitor

* Revert "lower debounding after adding capacitor"

This reverts commit eadbec23596bf6b46ec750a5ae519e8f1893876e.

* remove customized gitignore

* Revert "remove customized gitignore"

This reverts commit ce44131c7afdb53964067073e4a52ab8e3fe8f4b.

* reduce debounding period due to adding capacitor

* uncomment all tool change source code

* Tets Fräse 2.6 ok

* Fräse 2.6

* Falscher GPIO Pin für Fräse

* test

* Revert "test"

This reverts commit 1265435786eb327226553c5178f942cd96f08888.

* No Bluetooth necessary

* OTA update (watch Windows firewall!)

* - rename custom machine file name
-added "4axis_xyza.txt" to store Grbl_ESP32 config parameters.
So programming fits to parameters
- added 2 buttons (#1 hold/resume), #2 homing and tool change position

* new Z probe button

* Z probe corretion

* Z probe correction

* Z probe correction

* Fixed Grbl.h

- I think I deleted the GRBL_VERSION line by accident when using the web based conflict editor

* Revert "Merge branch 'Devt' of https://github.com/bdring/Grbl_Esp32 into Devt"

This reverts commit 361558b6b74f1ab6ae60fa250207081b941f6c20, reversing
changes made to 811646f5e77ce838082ee3c89a5ea99aa6ef9fd5.

* Revert "Merge remote-tracking branch 'Grbl_Esp32_JH/master' into Devt"

This reverts commit 811646f5e77ce838082ee3c89a5ea99aa6ef9fd5, reversing
changes made to a61ab51c0bab36195644f7438dc82e84af32a5a9.

* Update SettingsDefinitions.cpp

- Double definition of direction_delay_microseconds & enable_delay_microseconds

* Update Grbl.h

Co-authored-by: Jens Hauser <44340656+JensHauser@users.noreply.github.com>
Co-authored-by: Mitch Bradley <wmb@firmworks.com>
Co-authored-by: JensHauser <jens@hauser-digital.de>

* Clean up -WIP (#801)

* Clean up

* Remove not necessary

Co-authored-by: Luc <luc.@tech-hunters.com>

* External mach def (#807)

* Initial release with custom machine

* initial release

* Wrong addition corrected. AmoutOfToolChanges counts up now.

* pressing Z probe button once is fine, not a second time. reporting not in sequence to function flow

* First working FreeRTOS task with static text. Send "471" every second to all outputs

* Z Probe triggered correctly at button pressed. Can read out all values

* gitignore

* running with state machine, repeatable results in test environment

* works, except that function "user_tool_change" starts the tool change and it will interfer with further g code running in parallel. tbd

* typo

* back to without RTOS.But doesnt move

* RTOS but only with "T1 m06". not with g code program

* hold is better than door

* initial wifi settings

* umlaute

* gitignore

* Fehler bei Limit_Mask

* Spindle_Type angepasst

* lower debounding after adding capacitor

* Revert "lower debounding after adding capacitor"

This reverts commit eadbec23596bf6b46ec750a5ae519e8f1893876e.

* remove customized gitignore

* Revert "remove customized gitignore"

This reverts commit ce44131c7afdb53964067073e4a52ab8e3fe8f4b.

* reduce debounding period due to adding capacitor

* uncomment all tool change source code

* Tets Fräse 2.6 ok

* Fräse 2.6

* Falscher GPIO Pin für Fräse

* test

* Revert "test"

This reverts commit 1265435786eb327226553c5178f942cd96f08888.

* No Bluetooth necessary

* OTA update (watch Windows firewall!)

* - rename custom machine file name
-added "4axis_xyza.txt" to store Grbl_ESP32 config parameters.
So programming fits to parameters
- added 2 buttons (#1 hold/resume), #2 homing and tool change position

* new Z probe button

* Z probe corretion

* Z probe correction

* Z probe correction

* Fixed Grbl.h

- I think I deleted the GRBL_VERSION line by accident when using the web based conflict editor

* Revert "Merge branch 'Devt' of https://github.com/bdring/Grbl_Esp32 into Devt"

This reverts commit 361558b6b74f1ab6ae60fa250207081b941f6c20, reversing
changes made to 811646f5e77ce838082ee3c89a5ea99aa6ef9fd5.

* Revert "Merge remote-tracking branch 'Grbl_Esp32_JH/master' into Devt"

This reverts commit 811646f5e77ce838082ee3c89a5ea99aa6ef9fd5, reversing
changes made to a61ab51c0bab36195644f7438dc82e84af32a5a9.

* Add example of external machine def

- This sets some of the important timing parameters.
- Removed redundant example to keep example count down

* Update Grbl.h

Co-authored-by: Jens Hauser <44340656+JensHauser@users.noreply.github.com>
Co-authored-by: Mitch Bradley <wmb@firmworks.com>
Co-authored-by: JensHauser <jens@hauser-digital.de>

* Fix VFD speed change from ISR (#811)

* Motion control calls set_rpm frequently from an ISR. Unfortunately the last change added some debug information in there, which can cause the ESP32 to crash in boundary cases.

* Update Grbl.h

Co-authored-by: Stefan de Bruijn <stefan@nubilosoft.com>
Co-authored-by: bdring <barton.dring@gmail.com>

* Update Grbl.h

* Update TMC2209_4x.h

* changing  to EXTENDED type from GRBL type to prevent sender issues  (#821)

* Devt (#819)

* Fixed various small bugs (#605)

* Fixed various small bugs

* Fixed potential cast bug

* Fixed double reporting of errors

Co-authored-by: Stefan de Bruijn <stefan@nubilosoft.com>

* Stallguard tuning (#607)

* Devt (#571)

* Handles Tranimic drivers errors better

- If an unsupported driver is specified, it will give a message and not crash.

* Cleaned up unused files

Got rid of old unipolar files
Got rid of servo axis feature - it is a motor class now
Got rid of solenoid pen feature - never really used and it should be a motor class if it is.

* Fix ENABLE_AUTHENTICATION (#569)

* Fixed authentication code.

* Removed another const cast

Co-authored-by: Stefan de Bruijn <stefan@nubilosoft.com>

* Fix step leakage with inverted steps (#570)

* Fix step leakage with inverted steps

* Update build date for merge

Co-authored-by: Bart Dring <bdring@buildlog.net>

Co-authored-by: Stefan de Bruijn <atlaste@users.noreply.github.com>
Co-authored-by: Stefan de Bruijn <stefan@nubilosoft.com>
Co-authored-by: Mitch Bradley <wmb@firmworks.com>
Co-authored-by: Bart Dring <bdring@buildlog.net>

* Update platformio.ini

Per PR 583

* Created an enum for mode

* Removing some unused machine defs

* Added test machine definition

* Clean up for PR

* Remove test machine def.

Co-authored-by: Stefan de Bruijn <atlaste@users.noreply.github.com>
Co-authored-by: Stefan de Bruijn <stefan@nubilosoft.com>
Co-authored-by: Mitch Bradley <wmb@firmworks.com>
Co-authored-by: Bart Dring <bdring@buildlog.net>

* Basic testing Complete

* Made state variable volatile.

* Homing cycle settings (#613)

* Initial Tests Complete

* Update Grbl.h

* Update variables

Co-authored-by: Mitch Bradley <wmb@firmworks.com>

* fixed dual switches when inverted (#614)

* fixed dual switches when inverted

* Removed debug message

* Cleaning up the machine defs

Removed unused #defines.

* Store coordinate offsets in NVS (#611)

* Store coordinate offsets in NVS

* Handle both old Eeprom formats

* Implementing fixes (#616)

- Stop creating additional tasks when limit_init() gets called again from homing and resets
- Explicitly delete an object that was causing a memory loss.

* Update Grbl.h

* Tweak memory fix and add $H check for $Homing/Cycles

* Fix G28.1 and G30.1

* Update Grbl.h

* Homing cycle defaults (#624)

* Changed to add homing cycle defaults

There needs to be a way to set the homing cycle defaults in a machine definition.
There will likely be a better way to do this in the future.

* Update 10vSpindle.cpp

Had wrong error message

* Fixed typos and removed obsolete #defines

* Probe cleanup (#625)

* Cleanup probing code

* Update Grbl.h

* Update after review

* Update error_codes_en_US.csv

* More sd_close() to free memory (#622)

* Changed buffer sizes to 256 throughout various parts of the program. (#626)

This is a patch necessary for F360 personal users, because they decided to add a very lengthy comment...

Co-authored-by: Stefan de Bruijn <stefan@nubilosoft.com>

* $sd/show and handle settings in SD files (#629)

* $sd/show and handle settings in SD files

* Added $LocalFs/Show and fixed $LocalFs/Run output

* Infer / at beginning of SD path name

The LocalFS path processing code already inserts
a / at the beginning of the path is one isn't
present.  This patch does the same for SD files.

* Show $ command responses in WebUI console

* Added $Settings/ListChanged AKA $SC

This is useful for saving settings in a compact form that
leaves defaults unchanged.

* $sd/show works in idle or alarm state

* Apply idle/alarm checks to SPIFFS files too

* Changed sd_close to SD.end()

sd_close was a temporary function to check for memory usage

* Big BUILD_INFO fix (#632)

-- Changes that affect behavior

Fixed the bugs with report_build_info()

Build info is no longer stored in the fixed "EEPROM" section; instead it
is a proper Setting named $Firmware/Build .  You can change it in the
usual way with $Firmware/Build=<whatever>

$I without the = still works.

-- Changes that affect configurability for developers

Converted a couple more #defines into enums - SETTINGS_RESTORE_*
and BITFLAG_RT_STATUS_* .  A side effect of this is that it is
no longer possible to configure the behavior of $RST=* by defining
SETTINGS_RESTORE_ALL to include only a subset.  I think it is
a bad idea from a customer support perspective to have the meaning
of this command be different for different builds.

Changed some of the #define ENABLE_ names to eliminate "EEPROM"

-- Changes that are purely cosmetic

Clarified descriptions in Config.h, to eliminate spurious/incorrect mentions
of "EEPROM"

Eliminated all mentions of the name "EEPROM" except the ones
that truly mean the EEPROM section, as opposed to generalized
non-volatile storage.

The contents of SettingsStorage.h and SettingsStorage.cpp, which
were really related to coordinate storage in Eeprom, not proper
settings, were moved to Eeprom.h and Eeprom.cpp.  The SettingsStorage
files are gone.

Got rid of get_step_pin_mask() and get_direction_pin_mask() because
they were just aliases for bit().  That eliminated some junk from
the SettingsStorage/Eeprom files.  Those files now tightly contain
only the residual stuff related to the storage of coordinate data
in EEPROM.

* Most #defines are gone (#595)

* Many more #defines bite the dust

* Fixed botch in rt accessory logic

* Update Probe.cpp

* Update System.cpp

* Typo

* Fixed WebUI crash (#633)

While eliminating a redundant definition of is_realtime_command(),
I inadvertently introduced a recursion due to the similarity of
the names "is_realtime_command()" and "is_realtime_cmd()".  The
solution is to eliminate the latter entirely.

* Fix i2s probing hang (#608)

* Fix I2S stepper hung just after the completion of motor moving

* Fix recompile issue

Fixed a problem with the recompile not being recompiled even if the files under the Custom folder are changed.

* More comment for macOS in debug.ini

* Fix the timing of calling I2S out's exclusion function and reset sequence

The reset sequence did not seem to be correct, so I changed it.
According to the ESP-IDF PR, the correct sequence is as follows:
1)TX module
2)DMA
3)FIFO
https://github.com/espressif/esp-idf/commit/c7f33524b469e75937f003d4c06336bf4694a043#diff-27688c6b3c29373d2a2b142b8471981c

* Changed the message level for I2S swtiching from warning to debug

* Add some comments

* Implement stepping through Motors class (#636)

* Implement stepping through Motors class

WIP for discussion and review - not ready to merge yet

* Document Motor methods and variables

.. and remove some unused ones and move some
that are subclass-specific

* Move position_min/max to Limits.cpp

... and coalesced other uses thereof into a unified scheme.

* Call motor ->init() explicitly instead of implicitly

This makes it possible to inherit constructors without
spurious config messages.

* Fixed problems with I2S

* Changes in class method override syntax per atlaste

* Fixed oops

* More Motors simplification

a) Eliminated can_home() in favor of a return value from
set_homing_mode()
b) Eliminated axis_name() in favor of reportAxisNameMsg()

* Fixes to RcServo and Trinamic

- RC Servo was not handling disable ... probably old issue
- Display test after config

* More tweaks

* Define that variable!

* Move functions from Motors.cpp to subclasses

Created a Servo base class from which RcServo and
Dynamixel2 are derived.  This gets the servo update
task out of Motors.  It also eliminates the need for
type_id.  Now all of the functions that are specific
to particular kinds of motors are within their subclasses

* Adding Dynamixel to ABC axes.

* Removed second #ifndef SPINDLE_TYPE

* Fixed potential leak in Report.cpp

as reported by @atlaste

* Some servo cleanup. Has errors!

* min should be max

* Removed test rcservo machine definition.

* Removed obsolete #defines in machine defs for RcServo cal

Co-authored-by: bdring <barton.dring@gmail.com>

* Cleaned up AMASS code (#635)

* Cleaned up AMASS code

More #defines gone
74 lines shorter

Tested by comparing the result of original AMASS computation code to
the new code with values surrounding all of the cutoff frequencies.

* I2SOut tick calculation

* Sorted out units for stepper pulse periods

I tried to make it clear what the units are
at different places in the code, and to use
argument datatypes that clearly show the
value range at different points, instead of
relying on implicit type promotion.  Hopefully
this will make it easier to understand when,
where, and why unit conversions occur.

* Update Stepper.h

* Deleted AMASS Config.h option

... as it is no longer optional

* Use less memory (#644)

a) closeFile() now does SD.end() to release memory
after running a file from SD.
b) Several task stacks are smaller
c) All tasks now check their free space if DEBUG_REPORT_STACK_FREE
is defined.  platformio.ini has a commented-out line that can be
uncommented to turn that on.
d) Similarly, platformio.ini can turn on DEBUG_REPORT_HEAP_SIZE
e) Fixed a small leak that occurred when listing local files.

With these changes, the heap size tends to hover around 53K, dropping
to about 37K when running a file from SD.

* Add coolant pin messages to startup (#647)

* Add coolant pin messages to startup

Help with user support.

* Removing incorrect STEPPER_RESET definition

* Fix laser mode startup message

* cleanup

- coolant_init() will behave as before
- update build date
- return default machine to test_drive

* Move CoreXY out of main Grbl (#653)

* Created branch

* WIP

* Update parallel_delta.cpp

* Wip

* WIP

* Wip

* Still working on kinematics

- Added an interface into the jogging section

* WIP

* WIP

* wip

* WIP

* WIP

* Wip

* WIP

* WIP

* Wip

* Update machine defs

* Created branch

* WIP

* Update parallel_delta.cpp

* Wip

* WIP

* Wip

* Still working on kinematics

- Added an interface into the jogging section

* WIP

* WIP

* wip

* WIP

* WIP

* Wip

* WIP

* WIP

* Wip

* Update machine defs

* Machine def change. Moved switches to module 1

* WIP

* Cleanup before P.R.

- Fixed ranges for delta geometry
- Added post homing delay option for servos
- renamed and removed old machine defs.

* Fixing initialization problem when not in USE_KINEMATICS mode

* Fixing Git Mess

* Publishing Branch

- Not ready yet. Issues with Z axis
- Need to add midTbot option

* WIP

- Seems to be fully functional now.
- Need to add midTbot option.

* Update CoreXY.cpp

* I think it is ready for PR

- fixed $RST=#
- added midTbot geometry factor

* Fine tune midtbot definition

* Removed more unneeded corexy code.

* Fixed doubled #define in machine def file.

* Update after review comments

* Added $A AKA Alarms/List command (#654)

* Added $A AKA Alarms/List command

Similar to $E AKA Errors/List

$E used to be AKA ErrorCodes/List

Also added $Errors/Verbose setting to display
full error text instead of the error number.
It defaults to true because it works with every
sender I have tried so far - cncjs, UGS, and Chrome
GCode Sender.  If you have problems with some sender
you can set it to false.

* Added static_assert per atlaste's comment

* Added a default and fixed Authentication issue

Co-authored-by: bdring <barton.dring@gmail.com>

* TMC2130 plotter machine servo config update (#657)

* TMC2130 plotter machine servo config update

based on Slack conversation https://buildlog.slack.com/archives/CBZKZ8LHL/p1604243530253000

* Update Grbl.h

* Trinamic reporting (#656)

* Enhanced reporting of errors

* Change "motor" to "driver" for clarity.

* Added better way to show changed Setting values from Mitch

* Update build date

* Machine Definition Cleanup (#658)

- Removed machine definitions to speed up testing.
- Moved 6 pack CS/MS3 pins with other axis pins to help them stay in sync with the aixs letters

* Spindle delay and Telnet Fix (#676)

* Removed early saving of old state

Was causing later tests to be wrong

* Update Grbl.h

* Update TelnetServer.cpp

Remove filtering of '\r' character.

* ABC Bresenham counter init fix

* Rst responses (#679)

* Added verification of changes from $RST command

When sending $RST=$ you only get these responses.
[MSG:WiFi reset done]
[MSG:BT reset done]
Added the other things that change.
[MSG:WiFi reset done]
[MSG:BT reset done]
[MSG:Settings reset done]
[MSG:Postion offsets reset done]

* Update ProcessSettings.cpp

* Update Grbl.h

* Update ProcessSettings.cpp

* Fix Spindle State broken in earlier PR

* Update Grbl.h

* Spindle and laser (#683)

* WIP

* Updates

* Updates

- Added Laser/FullPower
- Move some stuff from PWM to Laser

* WIP

* Used the stop function before resetiing pins.

* Updates from discussion

- Reset_pins is now deinit()
- VFD task is now deleted when ... deinit()
- Added a Motor/Disable command

* Added Mitch's gambit

* Cleanup

- Finished VFD
- Fixed Settings (Thanks Brian!)
- changed task cores.

* Update VFDSpindle.cpp

* Update Laser.cpp

* Fixing reset

- gpio_reset_pin sets a pullup, which could turn on a device

* Changed Spindle messages to CLIENT_ALL

* Update Grbl.h

* Updates after review

* P.R. Cleanup

* Most spindle settings cause a new init()

* Laser mode (#692)

* Update Machine.h

* spindles now say if in laser mode

* name fix

* Updates

* Getting rid of crosstalk

* Update PWMSpindle.cpp

* Reset some values at spindle init()

* Update SettingsDefinitions.cpp

* Update Grbl.h

* Return to test_drive.h

* User macro button (#685)

* Test Macro Button Idea

* Updates

* Formating

* Changed macro pin reporting to be a single character

* Sd Web UI issues (#698)

* Updates

* returned reportTaskStackSize(uxHighWaterMark);

In a #ifdef DEBUG_TASK_STACK guard

* Disallow web commands unless idle or alarm state

* merging stuff after review

* Handle SD busy state in webserver handler (#697)

* Handle SD busy state in webserver handler

* Update index.html.gz

* Fixed reporting

* Add case for SD not enabled.

* Prevent Web commands except in idle or alarm

* Return authentication to the default

Co-authored-by: Mitch Bradley <wmb@firmworks.com>
Co-authored-by: Luc <8822552+luc-github@users.noreply.github.com>

* Update axis squaring checking (#699)

* Reverting some spindle changes...

CLIENT_ALL caused queue issues

* Rate Adjusting Fix

* Fix SD card hanging on bad gcode

* Fix hang on error 20 from SD/Run (#701)

* Fixed strange WCO values on first load (#702)

When loading Grbl_Esp32 into a fresh ESP32, the WCOs
would often have strange, very large, values.  The problem
was the code that tries to propagate data from the old
"Eeprom" storage format into the new NVS scheme.  The old
format had a broken checksum computation that made the
checksum so weak that if succeeds about half the time on
random data.

The solution is to get rid of all that old code.  The downside
is that migration from a build that uses the old format will
lose the WCO values.  The user will have to reestablish them.
Subsequent updates between different versions that both use
the new NVS format will propagate WCO values correctly.

* Fixes to homing (#706)

* Fixes to homing

* Update Grbl.h

* Clean up after code review.

* Trinamic uart (#700)

* WIP

* WIP

* Updates

* Update Grbl.h

* Removing some test machine definitions

* TMC5160 Drivers were not in tests

* Fix a few issues with VFDSpindle critical error handling (#705)

If a command is critical and fails to receive a response, it should trigger an Alarm. However, because the critical check was only evaluated if the spindle was not already unresponsive, it meant that a critical command failure would be silently ignored if a non-critical command failed before it (putting the VFDSpindle in unresponsive state). Therefore, I've moved the critical check to occur regardless of whether the spindle was already unresponsive.

Second, I believe that setting `sys_rt_exec_alarm` is not sufficient to stop the machine and put it into alarm state. Other alarm conditions (such as hard limits) also run an `mc_reset()` to stop motion first. It appears that without this, motion will not be stopped, and in fact, the alarm appears to get cleared if it occurs during motion!

* Update per P.R. #704 on main

* Update Motors.cpp

* Fix undefined probe reporting if inverted.

* Settings filtering via regular expressions (#717)

* Settings filtering via regular expressions

Implements only the most basic - and the most
useful - special characters - ^$.*

If the search string does not contain a special
character, it is interpreted as before.  Otherwise
the match is either more strict if anchored by
^ or $, or less strict if it contains a . wildcard
or a * repetition.

* Commentary

* Eliminated . metacharacter

* Fix SD/List repetition error (#727)

* Fix SD/List repetition error

The one line change that actually fixes it is
Serial.cpp line 162, where the SD state is compared
to "not busy" instead of "is idle", thus also handling
the "not present" case.

In the process, I converted the "const int SDCARD_ ..."
to an SDState enum class, thus proving type safety and
eliminating yet another untyped uint8_t .

* Updates after testing

Co-authored-by: bdring <barton.dring@gmail.com>

* Fixed RcServo Cals

* PWM fix and simplification (#722)

* PWM fix and simplification

This is an alternative solution to the PWM/ISR/float problem.

1. The set_level() argument is the exact value that is passed
to the LEDC Write function.  It can be interpreted as the
numerator of a rational fraction whose denominator is the
max PWM value, i.e. the precision, == 1 << _resolution_bits

2. There is a new denominator() method that returns the precision.

3. The sys_pwm_control(mask, duty, synchronize) function is
replaced by two functions sys_analog_all_off() and
sys_set_analog(io_num, duty).  This closely matches the
actual usage.  The old routine was called from two places,
one where the mask was alway 0xFF, the duty was always 0,
and synchronize was always false.  That is the one that
was troublesome from ISR context.  The other call always
affected a single pin, so the mask formulation with its
loop was useless extra baggage.  By splitting into two
functions, each one becomes much simpler, thus faster and
easier to understand.  The "synchronize" argument and
associated logic moved out to the caller (GCode.cpp),
which more closely reflects the behavioral logic.

4. For symmetry, sys_io_control() was similarly split.

5. sys_calc_pwm_precision() was moved into UserOutput.cpp
since is it driver specific, not a general system routine.

* Update Grbl.h

* Delete template.h

Co-authored-by: bdring <barton.dring@gmail.com>

* TMC2209 Stallguard (#748)

* TMC2209 Stallguard

- Added StallGuard homing support to TMC2209 (UART)
- Killed off TMC2208 for now. Too many conflicts with TMC2209. Will return with Diamond motor class hierarchy
- Increase StallGuard setting range for TMC2209. Constrianed in each class to actual limits
- Added a machine def to test TMC2209

* Update build date

* Web cmd modes (#754)

* Update System.cpp

* WebCommand with configurable modes

* Added a few more ESP commands to work in anu state

* Update Grbl.h

Co-authored-by: Mitch Bradley <wmb@firmworks.com>

* Updates from PWM_ISR_Fix branch (#755)

- $Message/Level
- ISR safe ledcWrite

* Core XY fixes (#756)

* Updates for CoreXY

* Delete fystec_ant.h

* Parking delay fix (#770)

* Changed delay type

- mc_dwell was causing a recursive loop the overflowed the stack
- See https://discord.com/channels/780079161460916227/786061602754396160/809288050387189782

* Changed spindle delays from floats to ints in spindle classes

- Used local copies, because I did not want to change/break the existing setting.

* Cleaning up parking

- Added a coolant delay setting
- Made an enum class for the dwell types
- Got rid of the safety door sepcific delays

* Update Grbl.h

* Enable per motor fix (#771)

* - moved invert option in front of per motor enables.

* Added code to prevent motors_set_disable() from setting values that already exist.

* Added the enable delay from PR 720

* Adding a defined default for step enable delay

* Fixing feed rates with kinematics and arcs.

- Kinematics changes the feed rate and the loop that creates arc was re-using the altered rate. This caused a runaway situation.

* SD Upload fix by luc (#779)

* Configure motors after I/O pins (#742)

So machine definitions can change the SPI pins before we talk to
any Trinamic drivers.

* 1.0.5 compilation fixes (#782)

* Fix compilations error due to new enum in esp32 core release 1.0.5

* Update Grbl.h

Co-authored-by: Luc <luc.@tech-hunters.com>

* Introduced delays for enable and direction pins (#720)

* Added some timing changes to steppers. Basically this should introduce a small (configurable) delay for enable and direction pins.

* Updates after testing

* Fixed small casting bug

* Fixed subtractions as per @Mitch's comments

* Added STEP_PULSE_DELAY handling for compatibility with RMT_STEPS. Functionality should be unchanged.

* Updates to help merge

Co-authored-by: Stefan de Bruijn <stefan@nubilosoft.com>
Co-authored-by: bdring <barton.dring@gmail.com>

* Vfd and mc_delay issues. Includes VFD sync speed. (#765)

* Added some timing changes to steppers. Basically this should introduce a small (configurable) delay for enable and direction pins.

* Updates after testing

* Fixed small casting bug

* Fixed subtractions as per @Mitch's comments

* Fixed busy flag in Stepper.cpp

* - Changed mc_dwell to double's, because float's have issues with context switches
- Changed spinup/spindown of VFD's to something more sensible
- Implemented advanced wait for spinup/spindown of VFD's

* Changed machine defs

* Implemented spindle speed sync. Made spindle safety polling optional; all the chatter appears to give issues somehow, not sure why.

* Made safety-polling optional.

* Added 'todo' for actual RPM code. Not sure how this should work though.

* Added safety check for unchanged RPM. Changed error output channels.

* Enabled the RPM code.

* Commented out again.

* Changed initialization sequence.
Implemented Huanyang initialization sequence.

* Made some fixes according to our latest insights in the manual

* Fixed docs.

* Fixed another bug in the comments

* Fixed set_speed RPM.

* Fixed huanyang message parsing. Fixed comments.

* Forgot a fall-through return.

* Updated status message after VFD initializes

* Changed output RPM test to output frequency test for sync.

* Changed mc_dwell to milliseconds and made it an integer. Fixed bug with negative values.
Fixed a dwelling bug in the VFD code, which would dwell indefinitely in cases such as safety door.

* Fixed a few small issues during the devt merge. Nothing serious.

* Not having critical initialization makes sense for the collet wrench lock thing (or just VFD's that are powered up later) in the sense that initialization should eventually happen to get the right values. Moreover, when the VFD enters an unresponsive state, re-initialization happens eventually.

* Changed 50 to 5000 for huanyang frequency calc.

* Updates after testing Huanyang

* Ran clang-format. Cleaned up the code a bit.

Co-authored-by: Stefan de Bruijn <stefan@nubilosoft.com>
Co-authored-by: bdring <barton.dring@gmail.com>

* Bug fixes (#790)

* Fix memory leak when answering webcommand (regression issue)

Fix wrong error code on  web command (regression issue)

* Fix sd code not disabled when SD Card feature is disabled

* Use proper error codes / messages

* Update Grbl.h

* Revert "Use proper error codes / messages"

This reverts commit ad49cf8cc1cb2064a8f7687cb4c354eba4bc8172.

* Updated error code symbols and text

- To be generic file system error

Co-authored-by: Luc <luc.@tech-hunters.com>
Co-authored-by: bdring <barton.dring@gmail.com>

* Get next rmt chan num fix (#793)

* Initial release with custom machine

* initial release

* Wrong addition corrected. AmoutOfToolChanges counts up now.

* pressing Z probe button once is fine, not a second time. reporting not in sequence to function flow

* First working FreeRTOS task with static text. Send "471" every second to all outputs

* Z Probe triggered correctly at button pressed. Can read out all values

* gitignore

* running with state machine, repeatable results in test environment

* works, except that function "user_tool_change" starts the tool change and it will interfer with further g code running in parallel. tbd

* typo

* back to without RTOS.But doesnt move

* RTOS but only with "T1 m06". not with g code program

* hold is better than door

* initial wifi settings

* umlaute

* gitignore

* Fehler bei Limit_Mask

* Spindle_Type angepasst

* lower debounding after adding capacitor

* Revert "lower debounding after adding capacitor"

This reverts commit eadbec23596bf6b46ec750a5ae519e8f1893876e.

* remove customized gitignore

* Revert "remove customized gitignore"

This reverts commit ce44131c7afdb53964067073e4a52ab8e3fe8f4b.

* reduce debounding period due to adding capacitor

* uncommen…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants