Commit Graph

4646 Commits

Author SHA1 Message Date
Alex Voinea
c7762386df
Merge pull request #3565 from wavexx/m115_respect_settings
Do not prompt on M115 if FW version check has been disabled
2022-08-25 19:43:12 +03:00
Yuri D'Elia
cf1edc85c3 Set a few function attributes to conserve space 2022-08-25 16:50:06 +02:00
Yuri D'Elia
7c8539a9f9 Report correct fan speeds in M155 during calibration 2022-08-25 16:15:51 +02:00
Alex Voinea
78534f3b48 Start at the first segment, not the last segment 2022-08-24 20:19:26 +03:00
Alex Voinea
671519caf3 Optimize by hand since the lto is still stooopit
saves ~100B
2022-08-24 20:19:26 +03:00
Alex Voinea
b27c8b50e0 Fix power panic handling 2022-08-24 20:19:26 +03:00
Alex Voinea
05bd1ba57f Multi-segment pause resume initial 2022-08-24 20:19:26 +03:00
DRracer
2e677ea3ee
Merge pull request #3569 from leptun/fix_card_removed
Fix "Card removed" on startup
2022-08-24 19:17:24 +02:00
DRracer
0933fdb6fe
Merge pull request #3552 from wavexx/temp_model_check
Thermal Model protection
2022-08-24 19:16:48 +02:00
Alex Voinea
ef8be4dfca Fix "Card removed" on startup 2022-08-24 20:10:09 +03:00
Alex Voinea
f2f136e014 Use timer3 instead of timer5 on miniRambo 2022-08-24 10:18:45 +03:00
Yuri D'Elia
7907e14cbf Resync planner position upon exiting xyzcal
Split the planner sync code out of planner_abort_hard() so that we can
independently resync the planner position from the counters.

This is needed in xyzcal as we directly modify the stepper counters
(bypassing both planner and stepper).

Call this new function instead of planner_abort_hard() when leaving, so
that motion can resume in the middle of the gcode_M45 instruction.
2022-08-23 17:25:24 +02:00
Yuri D'Elia
35708a61fe No longer disable temperature management in xyzcal
We already disable the heaters upon entering, and the new temperature
isr doesn't perform any direct movement until we return to the main
loop.

This allows us to remove direct control of the soft_pwm interrupt from
the header, which is dangerous.
2022-08-23 17:19:23 +02:00
Yuri D'Elia
7cd888cd0a Update documentation of ThermalStop() 2022-08-21 15:22:46 +02:00
Yuri D'Elia
b672be90b2 Do not overwrite saved values if TM error occurs while paused 2022-08-21 14:53:42 +02:00
Yuri D'Elia
d8d085287e Re-enable bed temperature automatically for transitory errors 2022-08-21 14:49:12 +02:00
Yuri D'Elia
30dccb3252 Switch to ATOMIC sections instead of cli/sei/CRITICAL_SECTION 2022-08-21 14:49:12 +02:00
Yuri D'Elia
ee12cbd58e Do not prompt on M115 if FW version check has been disabled
As done for M862.4, do now show an upgrade prompt if FW version check as
been disabled in the Settings -> HW Setup -> Checks menu.
2022-08-20 16:55:32 +02:00
DRracer
3ebd8b88a4
Merge pull request #3486 from gudnimg/gudni-optimisation
Flash optimizations in loop() and status screen menu
2022-08-19 17:21:17 +02:00
DRracer
0a8d2a3224
Merge pull request #3456 from wavexx/filament_load_consistency
Cleanup: use more constants in M701
2022-08-19 17:14:54 +02:00
DRracer
84888507e3
Merge pull request #3557 from wavexx/fix_g28_code_value
G28: check for X/Y/Z parameters before calling code_value_long
2022-08-19 17:12:07 +02:00
DRracer
2a0989c440
Merge pull request #3551 from wavexx/eof_crash_reentry
Prevent re-entry in EOF command processing
2022-08-19 17:07:21 +02:00
Yuri D'Elia
06d19b472a G28: check for X/Y/Z parameters before calling code_value_long
Fixes #3555, thanks to @toombaumarkt
2022-08-07 00:36:54 +02:00
Yuri D'Elia
3a1914f2fb Simplify printingHasFinished
Unswitch the call to file.close().

Do not call quickStop(): motion has already completed due to
st_synchronize.
2022-08-06 23:29:34 +02:00
Yuri D'Elia
4f22de2333 Do *not* shorten the current command in printer_smodel_check
printer_smodel_check was incorrectly substituting the final " with a
null in the command to simplify the model string comparison, but in
doing so was also corrupting the next pop from the cmdqueue.

We can modify the current strchr_pointer as long as we *don't* change
it's length. This can cause an incorrect extra read from the queue,
resulting in the last command to be completely ignored.
2022-08-06 23:15:46 +02:00
Yuri D'Elia
68c04ca2f6 Switch a few pointers that don't manipute strings to const 2022-08-06 23:08:03 +02:00
Yuri D'Elia
a533ba3574 Reset sdpos_atomic when starting a new SD print
Fix an incorrect SD offset on the first G-Code command when the second
SD print is started.
2022-08-06 22:16:50 +02:00
3d-gussner
8cbe69e285 Update RepRap documentation 2022-08-02 17:56:53 +02:00
3d-gussner
9633f34e89
Merge pull request #3544 from 3d-gussner/MK3_Fix_po_for-MK25s
Sync PF-build.sh and MK404-build.sh with MK3_3.11.1 branch
2022-07-29 16:13:59 +02:00
Yuri D'Elia
c0b5fea525 Prevent re-entry in EOF command processing
cmdqueue will run commands when EOF is reached without returning to the
main loop, which is already incorrect.

However, since it needs to ensure the queue is empty, an st_synchronize
call can result in a re-entrant call to get_command, which will
reprocess EOF again. Even if we removed st_synchronize, another command
could be picked by an unsuspecting manage_inactivity() somewhere else.

Short-circuit EOF processing by closing the file early and checking for
the file state early in get_command.

This should fix #3549
2022-07-29 15:55:54 +02:00
Guðni Már Gilbert
ca8d47a6da If lcd_draw_update is set outside lcd_status_screen
then render the sceen without delay

This adds only 10 bytes of flash
2022-07-27 11:55:08 +00:00
Guðni Már Gilbert
f6fd91a235 Optimise lcd_status_screen
Saves 20 bytes of flash
2022-07-27 11:14:18 +00:00
Guðni Már Gilbert
33a0a58810 Optimise manage_inactivity call in loop()
Saves 12 bytes of flash
2022-07-27 11:14:17 +00:00
Yuri D'Elia
c5c2557c5e Improve M310 documentation 2022-07-25 17:30:22 +02:00
Yuri D'Elia
41abe1689c Block LCD during temperature model autocalibration 2022-07-25 17:30:22 +02:00
Yuri D'Elia
79161f829e Remove last_alert_sent_to_lcd and simplify mintemp alert automaton
Thanks to LCD message priorities this not needed anymore and it's just
overhead.
2022-07-25 17:30:22 +02:00
Yuri D'Elia
374b829fb6 Generalize menu_block_entering_on_serious_errors for menu lockout
Call this variable menu_block_mask instead. We don't need to know the
exact reason of why we're locking the menu.

We will be able to reuse this to prevent menu entry during more
activities in a cleaner way than testing for each condition as it's
currently done for both menu entry and longpress.
2022-07-25 17:30:22 +02:00
Yuri D'Elia
49a288e6cf Restore the "MINTEMP * fixed" message
Set the LCD messages with the correct priority
2022-07-25 17:30:22 +02:00
Yuri D'Elia
4ca0012077 Prevent longpress if a serious error is set 2022-07-25 17:30:22 +02:00
Yuri D'Elia
cb3fec5cac Improve M310 documentation 2022-07-25 17:30:22 +02:00
Yuri D'Elia
e77a5345a2 Do not show "THERMAL ANOMALY" with "M310 B0"
This allows us to use "M310 B0 W0.01" as a way to report the current
error continuosly on the serial without 1) more code and 2) without
preventing regular usage.
2022-07-25 17:30:22 +02:00
Yuri D'Elia
19df196e1f Better differentiation between pause/paused resume/resumed states
Use OCTOPRINT_ASK_* for the present form of actions. In these cases the
host will perform the pausing manouvers for us.

Use OCTOPRINT_* instead for the past tense forms when we are in charge.

Also always emit the action, whether we are or not sd-printing. This is
due to the new Stopped handling behaving correctly in either case.
2022-07-25 17:30:22 +02:00
Yuri D'Elia
39ad53ab11 Simplify fan checks now that lcd pause works correctly 2022-07-25 17:30:22 +02:00
Yuri D'Elia
1eb7871bab Also save fan speeds during a thermal error pause
Similarly to temperatures, the fan speed is overwritten and needs to be
restored appropriately.
2022-07-25 17:30:22 +02:00
Yuri D'Elia
c98e133ae2 Never stop spinning the extruder fan on thermal failures 2022-07-25 17:30:22 +02:00
Yuri D'Elia
eccfcd7424 Save/restore temperatures during a thermal pause
Re-used saved_* vars (as normally used during the paused state) to
backup the original values when a thermal error occurs.
2022-07-25 17:30:22 +02:00
Yuri D'Elia
63dab63f2e uvlo: Never wait for bed temperature when recovering
If the user accepted to resume, do not wait for bed temperature when
recovering. This only adds a pointless delay when recovering a short
pause and doesn't really improve the recovery quality after a long
pause.
2022-07-25 17:30:22 +02:00
Yuri D'Elia
8f02262bbd Save/restore bed temperature during pause
This will be needed during a thermal error pause that disables the bed
as an additional safety precaution.
2022-07-25 17:30:22 +02:00
Yuri D'Elia
9ef80226c9 Rename argument of ThermalStop for clarity 2022-07-25 17:30:22 +02:00
Yuri D'Elia
b9fc73c4c3 TM: Pause the print and allow recovery from a thermal error
Do not allow resuming until all thermal and fan errors are clear.

Call the appropriate resume function when resuming a printing depending
on the saved_print state (is saved_print is available, then we always
need to resume from the saved state even when printing via usb).

Clear the Stopped state when resuming, so that commands can be accepted
again.
2022-07-25 17:30:22 +02:00
Yuri D'Elia
f454d1ecf2 TM autotune: fix off-by-one in fan power levels 2022-07-25 17:30:22 +02:00
Yuri D'Elia
5dc0d5f7fa TM autotune: fail if value is outside of the boundaries
Ensure we never fall into the boundary values provided by the min/max
limits.

Save/restore the initial guess value, so that a convergence failure
restores the initial model state.
2022-07-25 17:30:22 +02:00
Yuri D'Elia
d1864011f4 Handle pause/stop in the main loop, again
Force processing of the pause and stop "parking" commands _after_ the
main loop completes.

This was/is currently done in lcd_commands, which is a poor place to
continue processing, since it can be called already within an aborted
command. This requires checking for planner_aborted before any action
can be performed.
2022-07-25 17:30:22 +02:00
Yuri D'Elia
f835537e88 Exclude TempErrorSource::ambient for boards without a thermistor 2022-07-25 17:30:22 +02:00
Yuri D'Elia
5965572e88 Enforce full-loop handling of aborted commands
After calling planner_abort_hard() no motion command can be
scheduled until we return to the main loop since the call can
potentially be scheduled inside a nested process_command call.

Despite previous fixes, bugs keep creeping in due to nested calls not
being obvious to detect at all.

Stop allowing motion _completely_ for the entire processing loop by
default. That is, instead of aborting the current plan_buffer_line call,
abort the entire command until we can actually schedule motion safely
again.

This benefits handling of pretty much all g/m-codes, since this flag
(now "planner_aborted" for clarity) becomes a general "command aborted"
call.

This also now ensures that the flag prevents _any_ new block (including
blocks partially planned while servicing an interrupt) are scheduled
after planner_abort_hard is called.

There are only two exceptions where it's safe to resume in this context:

- Within uvlo_, where we never return to the main processing loop
- When we're intentionally scheduling a new process_command loop for a
  MK3 filament recheck (which is *bad*)

Handle those two cases as exceptions.
2022-07-25 17:30:22 +02:00
Yuri D'Elia
48c7c9d464 Exclude M310 if TEMP_MODEL is not enabled 2022-07-25 17:30:22 +02:00
Yuri D'Elia
142db85bbb Pause: only move to park position when homed
This can happen is pause is issued before homing.
2022-07-25 17:30:22 +02:00
Yuri D'Elia
fc10ca3146 Change how "Stopped" is handled internally, do not inhibit motion
Do not inhibit motion when Stopped is set.

We actually do need to move to move away the extruder from the bed, and
setting Stopped breaks it without adding any sort of security (M*
commands, such as M600 could still perform moves and still pass
through, while M104 would still set heaters).

During a hard error the internal queue is cleared (and sd file closed,
if any), so no new "unforeseen" command can be read.

Handle "Stopped" instead as a flag to inhibit serial processing and
automatically switch to "paused for user" state. While in this state
simply drop any input without incrementing the processed gcode line
number, behaving as-if the last command was still being processed.

This allows "Stopped" to correctly handle a printer-initiated paused
state and recover as expected by requesting a resend when resuming.
2022-07-25 17:30:22 +02:00
Yuri D'Elia
b3ca70a007 Show thermal warnings using the new LCD_MESSAGE_INFO priority
Add a new LCD_MESSAGE_INFO priority which can be overridden by regular
status updates, but only if a certain amount of time has passed.

Assign a time stamp to all message updates, so that the time since the
last update can be determined. Also switch the message type to Status,
so that the message always becomes visibile.

Always show status or info messages when printing via SD if the message
is recent enough.
2022-07-25 17:30:22 +02:00
Yuri D'Elia
8d9d367d6b Implement Timer::expired_cont()
Returns true if the timer is not running, effectively allowing to check
if a certain set time in the future has passed.
2022-07-25 17:30:22 +02:00
Yuri D'Elia
dc2d596f40 Do not allow lcd_updatestatus to be called directly
Enfoce the usage of lcd_setalertstatuspgm and lcd_setstatus so what we
consistently have alert severities properly set.
2022-07-25 17:30:22 +02:00
Yuri D'Elia
6751586db6 Cleanup original thermal error handlers.
Remove useless repeated calls to disable heaters and turn on the fans,
since this is done at a higher level.

Avoid repeating messages on the serial. Do it just once.

Make a critical alert sound unconditionally.
2022-07-25 17:30:22 +02:00
Yuri D'Elia
50c71924a2 Include fan measurements when estimating resistance 2022-07-25 17:30:22 +02:00
Yuri D'Elia
92bc7554b6 Enable the model last, if set
We need all the values to be set before we can attempt to enable the
model.
2022-07-25 17:30:22 +02:00
Yuri D'Elia
49048fdcd6 Add temperature model configuration for MK3 2022-07-25 17:30:22 +02:00
Yuri D'Elia
ea0840dee9 Refuse to run TM calibration if the printer is not idle 2022-07-25 17:30:22 +02:00
Yuri D'Elia
9c971b1b89 Add a note about resetting waiting_inside_plan_buffer_line_print_aborted 2022-07-25 17:30:22 +02:00
Yuri D'Elia
0680c0b428 Refresh the lcd periodically during calibration 2022-07-25 17:30:22 +02:00
Yuri D'Elia
47d2e9e61c Handle failures during calibration
Break out of the autotuning if a thermal error condition is detected and
attempt to restore a safe initial state irregardless of the error
handlers.

Also error out if the estimation fails to converge.
2022-07-25 17:30:22 +02:00
Yuri D'Elia
cc96a47e7f Implement temperature model autotuning
Calibrate C/R values via univariate minimization using golden section.
This is done in several passes:

- Bootstrap C by setting an initial high R value
- Calibrate R at the requested working temperature
- Cooldown
- Refine C to the final value
- Estimate R losses for a subset of fan speeds
- Interpolate remaining values to speed-up the process

This results in robust values which are tailored to the current
filtering constants, and avoid having to sample for an extended
time to reach the required resolution.

The refining pass could avoid cooldown if the recording buffer was at
least twice as large, so that we could record both the heating and the
steady-state, saving _considerable_ time.
2022-07-25 17:30:22 +02:00
Yuri D'Elia
ec74b88ebc Correct pre-warning to just warning 2022-07-25 17:30:22 +02:00
Yuri D'Elia
14622bc577 Actually disable the temperature manager in TempMgrGuard 2022-07-25 17:30:22 +02:00
Yuri D'Elia
8620059067 Allow to disable the model warning beeping
Mostly useful for debugging
2022-07-25 17:30:22 +02:00
Yuri D'Elia
6832ec7648 Allow to save/restore temperature model settings
This currently bypasses the ConfigurationStore, which doesn't fit the
malin model nicely.

temp_model is using it's own private copy directly.

But maybe we should change this in the future.
2022-07-25 17:30:22 +02:00
Yuri D'Elia
b0b2ff5f9e Rewrite/modularize the model checker
- Allow all parameters to be changed at runtime through M310
- Move the model prototypes into a separate temp_model.h header
- Allow the checked to be enabled/disabled at runtime
- Introduce a warning threshold
2022-07-25 17:30:22 +02:00
Yuri D'Elia
fabf511b97 Add the ability to log continuously
TEMP_MODEL_LOGGING enables D70 to record precisely each cycle of the
temperature regulation for offline model simulation
2022-07-25 17:30:22 +02:00
Yuri D'Elia
690affe5a2 Further enhance thermal error priorities
When triggering a thermal error, allow higher-priority errors to
override the initial error source.

This allows a fatal error such as maxtemp to trigger to a full stop even
if thermal runaway has already been triggered.

Reorder error types according to their priority.
2022-07-25 17:30:22 +02:00
Yuri D'Elia
8220d0196b Lock onto the first error source until cleared
Do not overwrite the error source if the error flag is already set.

As checks are performed in priority order, this ensures min/maxtemp
user-level handlers are triggered even if the thermal model can detect
an issue in the same cycle.

This restores MAXTEMP handling, which was simply shadowed.
2022-07-25 17:30:22 +02:00
Yuri D'Elia
f82048977a Start PWM timers _after_ initializing min/maxtemp ranges
This would otherwise cause check_temp_raw() to operate on unitialized
values and trigger failures too early.
2022-07-25 17:30:22 +02:00
Yuri D'Elia
f1d88ebd40 Protect pid_tuning_finished behind temperature.cpp
Setting pid_tuning_finished can result in the heaters stuck to full
power. As a result, we need to ensure that when PID management is
disabled, heaters are also.
2022-07-25 17:30:22 +02:00
Yuri D'Elia
442b2e16de Set pid_tuning_finished globally to true
Use pid_tuning_finished as a flag to prevent automatic PID management.
As a result, set the default start-up state to true and adjust the
dependent code accordingly.
2022-07-25 17:30:22 +02:00
Yuri D'Elia
92418e9d1b Do not perform PID management while autotune is running 2022-07-25 17:30:22 +02:00
Yuri D'Elia
c15d599f71 Convert two PID_autotune strings to PROGMEM 2022-07-25 17:30:22 +02:00
Yuri D'Elia
0c1c350a93 Simplify one expression 2022-07-25 17:30:22 +02:00
Yuri D'Elia
70093fc9dc Allow to redefine basic model constants 2022-07-25 17:30:22 +02:00
Yuri D'Elia
a15f2807d9 Allow to continue printing with TEMP_MODEL_CHECK_WARN_ONLY for debugging 2022-07-25 17:30:22 +02:00
Yuri D'Elia
929843e295 Switch two divisions to faster multiplications 2022-07-25 17:30:22 +02:00
Yuri D'Elia
bc53bd5305 Make the error threshold be sample-rate invariant 2022-07-25 17:30:22 +02:00
Yuri D'Elia
3eda8b61ee Include the model checker with hard-coded constants 2022-07-25 17:30:22 +02:00
Yuri D'Elia
61575995e0 Isolate temp runaway checks from PID management 2022-07-25 17:30:22 +02:00
Yuri D'Elia
026733e75f Improve comments 2022-07-25 17:30:22 +02:00
Yuri D'Elia
283d5566f1 Limit the rate manage_heater() as it did previously
Avoid running the user-level error handlers too fast.
2022-07-25 17:30:22 +02:00
Yuri D'Elia
de77a47906 Correct handling of preheat/runaway errors
As for min/maxtemp, flag the error in the isr, then handle it in the
user code calling the original handler.
2022-07-25 17:30:22 +02:00
Yuri D'Elia
bd9a6acd59 Correct handling of min/maxtemp
- Flag the error condition from the temp_mgr_isr
- Handle the error state from the user code

Currently only handles min/maxtemp and relays the error to the original
handler (which is a poor fit for the current design).
2022-07-25 17:30:22 +02:00
Yuri D'Elia
4a0203d691 Isolate oTimer4minTempHeater/Bed into check_min_temp 2022-07-25 17:30:22 +02:00
Yuri D'Elia
7659844012 Reimplement disable_heater to take immediate effect
Split off setIsrTargetTemperatures and temp_mgr_pid() so that we can
propagate the target temperatures instantaneously down the pid/pwm chain
during emergencies.

This reduces the amount of code in disable_heater() itself, making it
a bit more maintenable.

The bed still isn't disabled on-the-spot yet, due to the heatbed_pwm
automaton. To be improved later.
2022-07-25 17:30:22 +02:00
Yuri D'Elia
e070bc6455 Remove obsolete and commented variables 2022-07-25 17:30:22 +02:00
Yuri D'Elia
ccaecc87aa Reduce code duplication in setTargetHotendSafe 2022-07-25 17:30:22 +02:00
Yuri D'Elia
7d82cd641e Rename ADC callback 2022-07-25 17:30:22 +02:00
Yuri D'Elia
bcd8496113 Introduce a new set of temperature values for the PID regulation
*_temperature_raw: buffer for the ADC ISR (read by temp ISR)
*_temperature_isr: latest temperatures for PID regulation (copied from
  _raw values)
*_temperature: latest temperature for user code

The flow:
  - ADC ISR (async)
    - perform oversampling
    - call ADC callback: copy to _raw (async)
  - temp ISR (timer)
    - convert to C (_isr values)
  - user code (async)
      - check temp_meas_ready
      - call updateTemperature()
        - copy from _isr to current
        - syncronize target temperatures

This removes PINDA value averaging (if needed, should be re-implemented
by averaging in user code where needed)
2022-07-25 17:30:22 +02:00
Yuri D'Elia
c1051e046c Remove private declaration 2022-07-25 17:30:22 +02:00
Yuri D'Elia
65cf8e541a Isolate current/target temperature in pid_heater/bed functions 2022-07-25 17:30:22 +02:00
Yuri D'Elia
0933f01a7f temperature: Do not expose check_min/max_temp 2022-07-25 17:30:22 +02:00
Yuri D'Elia
9e826afee9 Switch regulation interval to 270ms 2022-07-25 17:30:22 +02:00
Yuri D'Elia
c6d0494cbc Split temperature management into it's own ISR
Use a new low-priority "temp_mgr_isr" running at constant rate for
temperature management.

This is done so that the temperatures are sampled at a constant
independent interval *and* with reduced jitter. Likewise for actual
PID management.

This will require further adjustment for the min/max/runaway display,
which cannot be done directly into this function anymore (the code will
need to disable heaters but flag for display to be handled in
manage_heaters).
2022-07-25 17:30:21 +02:00
Yuri D'Elia
2ca16a06cd Rename tp_init to soft_pwm_init for consistency 2022-07-25 17:30:21 +02:00
Yuri D'Elia
b56d31b5b3 Improve comment 2022-07-25 17:30:21 +02:00
Yuri D'Elia
38b3e53f67 Syntax/comment cleanup 2022-07-25 17:30:21 +02:00
Yuri D'Elia
932fcbb33f Simplify soft_pwm_isr even further
Isolate the PWM management into soft_pwm_core
2022-07-25 17:30:21 +02:00
Yuri D'Elia
dfd8fee712 Isolate babystep to a separate function 2022-07-25 17:30:21 +02:00
Yuri D'Elia
bd28007312 Rename check_fans>readFanTach manageFans>checkFans 2022-07-25 17:30:21 +02:00
Yuri D'Elia
383319dbac Rename temperature_isr to soft_pwm_isr 2022-07-25 17:30:21 +02:00
Yuri D'Elia
16b9acf8bc Decouple temperature ISR from ADC readings
Read from ADC as fast as possible using the ADC interrupt to get
more accurate instantaneous readings.

Decouple the temperature_isr from the adc reading interval, so that
the two can run independently for future use.
2022-07-25 17:30:21 +02:00
Yuri D'Elia
e87188e7e3 Ensure ADC and thermistor tables use the same oversampling
The current code assumes that values are directly comparable
2022-07-25 17:30:21 +02:00
Yuri D'Elia
2535d072c4 Do not recursively enter temperature_isr
Disable the interrupt source instead, which avoids the added latency of
reentering the isr in the first place.
2022-07-25 17:30:21 +02:00
Yuri D'Elia
82e221e3c7 Remove ADC pullup checks
Setting pullups on the ADC should trigger the model-based check, making
this redundant and wasteful.

Keep the DEBUG_PULLUP_CRASH menu so that we can verify this behavior in
the future.
2022-07-25 17:30:21 +02:00
Yuri D'Elia
306f77ccbd Disable IR_SENSOR due to the injected ADC read for now
This is already reimplemented in the newer fsensor implementation
2022-07-25 17:30:21 +02:00
Yuri D'Elia
13163e9fbf Move millis_nc to system_timer.h 2022-07-18 17:53:27 +02:00
Yuri D'Elia
f8de274db3 Split fan checks out of temperature.cpp 2022-07-18 17:53:27 +02:00
Alex Voinea
8e72470afc
Merge pull request #3435 from leptun/MK3_variant_hotend_name
Use correct filament type in variant files
2022-07-15 15:57:53 +03:00
Alex Voinea
510c874619 Fix scrolling timing issue when the menu is rendering very slowly 2022-07-15 15:46:01 +03:00
Alex Voinea
8bb451129d Remove compiler bug workaround
These lines had to be done like that because gcc 5.4.0 would throw a segmentation fault when linking. With gcc 7.3.0, this is no longer an issue
2022-07-15 15:46:01 +03:00
Alex Voinea
ae1815dc52 When over the SD limit, continue from the last sorted file
This gives a significant speed boost when just above the sorting limit, while only costing 2 bytes of ram
2022-07-15 15:46:01 +03:00
Alex Voinea
a96e60c241 Do not call lcd_update after presorting 2022-07-15 15:45:34 +03:00
Alex Voinea
3a5bc0462a Do not call lcd_update recursively when running presort with many files 2022-07-15 15:45:34 +03:00
Alex Voinea
3c579bf738 Fix fullscreen message lcd_update handling 2022-07-15 15:45:34 +03:00
Alex Voinea
2059e40596
Merge pull request #3054 from espr14/insert_sort
File: use insert sort
2022-07-15 15:44:04 +03:00
Alex Voinea
49fb27bb28
Merge pull request #3504 from gudnimg/gudni_printer_smodel_check
Simplify `printer_smodel_check()`
2022-07-12 21:53:23 +03:00
3d-gussner
15bac09594 Fix typo 2022-07-12 11:24:35 +02:00
Alex Voinea
3ed3f87db6 Prevent beeps when P is 0 2022-07-12 09:57:56 +03:00
Yuri D'Elia
2a9869ce2d M300: do not set a default frequency if S is not set
Fallback to use the default HIGH value if a frequency has not been
specified.

This makes the tone of "M300" and "M300 P<x>" identical as a result.

Supersedes #3339
2022-07-11 15:18:56 +02:00
Alex Voinea
56bc2f1a0c
Merge pull request #3495 from wavexx/extrude_min_temp
Replace EXTRUDE_MINTEMP with the configurable extrude_min_temp
2022-07-05 12:02:26 +02:00
Alex Voinea
9466945532
Merge pull request #3461 from wavexx/fan_selfcheck_test
Fix/optimize fan selftest
2022-07-05 11:32:57 +02:00
Alex Voinea
19b494a554 Make the fan thresholds configurable 2022-07-05 09:02:47 +02:00
Yuri D'Elia
a8244dc2bd
Merge pull request #3455 from wavexx/stop_raise_higher
Stop raise higher
2022-07-04 20:05:23 +02:00
3d-gussner
6271f17340
Merge pull request #3442 from gudnimg/fix-M701-doc
Add documentation for M701, M203, M201 parameters
2022-07-04 18:51:31 +02:00
Alex Voinea
253b14def1 Clamp Z movements to machine limits 2022-07-04 18:26:14 +02:00
Yuri D'Elia
44fce0696b Make the stop raising distance configurable (Z_CANCEL_LIFT) 2022-07-04 18:21:59 +02:00
Yuri D'Elia
2c41857cb5 Raise Z 5cm after stopping
Check if Z axis has been homed and, if so, raise Z at least 5cm after
stopping so that the steel sheet can be comfortably removed.
2022-07-04 18:21:59 +02:00
Alex Voinea
61b8dbbab5 Disable sorting speedtest 2022-07-04 18:06:54 +02:00
Alex Voinea
e79e15b12f Use the sd cache for positions even when not sorting 2022-07-04 18:06:54 +02:00
Alex Voinea
d9d3d68217 Remove postponed sorting of elements
Now that the position is a uint16_t instead of uint32_t, it is simpler to just sort the positions in place without using the uint8_t indices. Also, this approach is considerably lighter on the stack usage and it also removes a delay after the sorting happens
2022-07-04 18:06:54 +02:00
Alex Voinea
c100df7ba3 Remove quicksort, shellsort and add performance benchmark 2022-07-04 18:06:54 +02:00
Alex Voinea
cac2b9ae40 Implement timer elapsed function
also fix build
2022-07-04 18:05:49 +02:00
Alex Voinea
490754a0f0 Fix build 2022-07-04 18:05:49 +02:00
espr14
02ca9496e8 File: use insert sort 2022-07-04 18:05:49 +02:00
Yuri D'Elia
e37435b53f Merge remote-tracking branch 'upstream/MK3_3.11.1' into mk311_sync 2022-07-04 16:14:23 +02:00
Alex Voinea
3ff2b04801 M701 Alias T for E parameter 2022-07-04 15:01:41 +02:00
Alex Voinea
fd702c8a21
Merge pull request #3527 from gudnimg/fix-cmdbuffer-debug-crash
Fix a crash during file check when `CMDBUFFER_DEBUG` is defined
2022-07-04 12:02:51 +02:00
Alex Voinea
d5fc2a28f2
Merge pull request #3014 from Panayiotis-git/MK3_ButtonLongPress_Fix
Ignore button long-press event, if not allowed
2022-07-04 09:46:08 +02:00
Alex Voinea
29159a5bf3
Merge pull request #3475 from gudnimg/custom_message_m601
Make M117 message persistent on LCD when used with M601 or G4
2022-07-04 09:42:23 +02:00
Alex Voinea
61151251ff
Merge pull request #3485 from wavexx/ambient_raw_temps
Fix AMBIENT_RAW_*_TEMP define names
2022-07-04 09:38:05 +02:00
Alex Voinea
1fa87da2d0 Fix gnu++17 register warning 2022-07-04 09:35:17 +02:00
Panayiotis-git
87e45056c3 Ignore button long press if not allowed 2022-07-03 22:01:47 +03:00
Guðni Már Gilbert
b64377b9de Fix a crash during file check when CMDBUFFER_DEBUG is defined
The file check is so slow that we need to kick the watchdog to prevent a "crash"
2022-07-02 16:54:05 +00:00
Alex Voinea
dc812dabb2 _O() macro
Ability to get the english (original) variant of a translated message. Helpful for serial messages where translations must be prohibited for compatibility.
2022-07-01 16:01:51 +02:00
Yuri D'Elia
af9daecf5b Correctly show XFLASH initialization errors
Remove the first serial message, which cannot be displayed since serial
is not available yet.

Move both the serial message and display after
serial/temperature/planner is setup, so that we can use
lcd_show_fullscreen_message_and_wait_P properly.
2022-06-29 11:44:53 +02:00
3d-gussner
f3adb781a1
Merge pull request #3457 from wavexx/remove_runout_support
Cleanup: remove unused FILAMENT_RUNOUT_SUPPORT define
2022-06-29 08:16:31 +02:00
Yuri D'Elia
0d7680dbf7
New PO-based language translation support (#3471)
* lang: Add a PO language extractor with FW metadata support

Implement a straight-to-po language extractor which supports our custom
language requirements:

- _i/_I/ISTR for text string definitions
- _T for catalog translations (with back-reference support)
- //// EOL comments with:
  - MSG_ catalog entry name identifiers
  - c=X r=Y annotations for screen dimensioning checks
- Crude support for commented lines

All source locations are correctly referenced in the PO, with the
metadata colleted in the comment for further processing.

Several checks are implemented already during extraction:

- Correct catalog name assignment (no duplicates)
- Metadata checks for each entry

Further checks will be implemented by directly checking the translated PO file.

Requires "polib" and "regex" python modules.

* lang: Adapt lang-check to work directly on PO/POT files

* lang: Allow lang-extract to generate stable (pre-sorted) output directly

* lang: Further extend lang-extract consistency/error checking

- Do not parse inside preprocessor conditionals
- Distinguish between references and definitions
- Warn about missing references and definitions

* lang: lang-extract: warn about incorrect PROGMEM assignments

Check that ISTR is used along with PROGMEM_I1 in an attempt to spot
useless translated catalogs.

* lang: lang-extract: Improved handling of same-line translations

Correctly reference metadata on same-line translations.

* lang: lang-extract: Handle _O as a cat-ref

https://github.com/prusa3d/Prusa-Firmware/pull/3434

* lang: lang-extract: Warn about unused catalog definitions

* lang: lang-extract: Allow propagating translation comments via //

The definition:

    code //// definition [// comment]

will check [definition] as before, but blindly accumulate // comment.
The comment is then re-appended back into the PO files for translators
with the form:

    definition
    comment
    comment...

* lang: Fix incorrect display definitions

* lang: lang-extract: Check source encoding/charmap

* lang: Translate the degree symbol

* lang: Unbreak/cleanup DEBUG_SEC_LANG

* lang: Improve meaning of comment

* lang: Split charset conversions into an aux lib for future use

* lang: Implement lang-map.py to extract the translation symbol map

- Extracts the translatable symbol map for further use
- Computes a stable "language signature" from the map itself
- Optionally patches the binary update the symbols

* lang: Check for translation recoding problems

* lang: Implement a transliteration map to post-process translations

TRANS_CHARS is now used to replace unavailable symbols to the source
encoding, only while producing the language catalog.

* lang: Handle/check character replacements in lang-check

Filter the translation through TRANS_CHARS, so that the preview and
length check are performed correctly for expanding replacements such as
'ß' to 'ss'.

* lang: Implement lang-build.py to generate the final language catalog

* Cleanup .gitignore

* lang: Drop txt language files

* lang: Remove outdated translation scripts and obsolete docs

* lang: Update build scripts for new infrastructure

* lang: [no] Integrate accents from po/new/no.po

We now support accents natively

* lang: Remove redundant directory po/new/

* lang: Fix encoding of LCD characters in PO files

* lang: [hr] Fix wrapping in MSG_CRASH_DET_ONLY_IN_NORMAL

* lang: Sort and reformat PO files for further massaging

* lang: Switch to developer (dot) comments for PO metadata

* lang: Allow the IGNORE annotation to skip extraction

* lang: Fix missing/broken language metadata in sources

* lang: Add update-pot.sh and regenerate po/Firmware.pot

* lang: Add update-po.sh and refresh all PO files

* lang: Add summary documentation about the new translation workflow

* Add more ignored files

* CI: Add new required dependencies to travis

* lang: lang-build: Improve warning message

"referenced" was really meaning that data is being duplicated.

* lang: Respect the language order as defined in config.sh

This correctly splits normal and community-made entries during language
selection.

* lang: More typos in the documentation

* lang: Check for the maximum size of each language

Each table needs to fit within LANG_SIZE_RESERVED

* lang: Properly align _SEC_LANG to page boundaries

... instead of relying on _SEC_LANG_TABLE to calculate the offset

* lang: Build support for dual-language hex files

Detect the printer type by checking the current variant type.

On printers with no xflash (MK2*), generate one hex file for each
additional language file by patching the built-in secondary language
table during the build process

* lang: Mention lang-patchsec.py

* lang: Use color() instead of tput for clarity

* lang: Allow disabling terminal colors with NO_COLOR/TERM=dumb

* lang: Consistent use of redirection in config.sh

* lang: Stricter variant-type check for xflash support

* lang: Output size stats when building double-language hex files

* lang: Respect NO_COLOR in lang-check.py

* lang: Check for repeated/incorrect annotations

Catch errors such as "c=1 c=2"

* lang: Correct MSG_SLIGHT_SKEW/MSG_SEVERE_SKEW annotations

* lang: [it] Improve MSG_*_SKEW translation

* lang: Use INTLHEX instead of OUTHEX_P/S for configuration

We already have OUTHEX which is the compiled firmware.

Use INTLHEX for the final internationalized firmware, which is less
confusing. Also, assume it being a prefix for all generated hex
files, which reduces the number of variables set.

* lang: Move lang_map to lib.io for further use

* lang: lang-check: Accept a firmware map file to suppress unused string warnings

* lang: Use the map file to reduce useless warnings during fw-build

* lang: lang-check: Also suppress unused empty annotations

* lang: Fix MSG_MOVE_CARRIAGE_TO_THE_TOP_Z annotation

Refresh pot file

* lang: lang-check: Do not warn about same-word translations by default

Do not warn when one-word translations such as "No" result in "No" also
in other languages, since this is common in latin languages.

Allow to re-enable the warning with --warn-same

* lang: lang-build: Handle same-source/translation efficiently

* lang: [it] Explicitly add On/Off/Reset/Wizard to suppress warnings

Instead of displaying a warning, supress the warning and explicitly
translate each entry using english (which is the common/acceptable
word in these cases).

* lang: [it] Suppress more warnings

* lang: lang-check: Add intermediate "suggest" warning category

Warnings in the "suggest" category as shown as [S] as based on pure
speculation from the checking tool, such as the translation being
significantly shorter than the original.

As a result, they can be suppressed with --no-suggest

* lang: Return translation status from lang-check

- 0 if the translation only contains suggestions
- 1 if the translation contains warnings or errors

Check for the exit status in fw-build.sh, but do nothing at the moment
except printing a non-fatal error.

* lang: Remove "trim_trailing_whitespace=false" for po files

PO files got cleaned up/rewritten. We can now ensure they stay
consistent.

* lang: [sv] Re-integrate changes from 70c73cb

* lang: [no] Reintegrate changes from @pkg2000
2022-06-16 15:03:30 +02:00
3d-gussner
880853650d
Version changed (3.11.1-RC1 build 4987) 2022-06-13 12:03:48 +02:00
3d-gussner
3ae4b6d329 Merge remote-tracking branch 'pkg2000/MK3_3.11.0' into HEAD
Fix merge issues and POEdit double `\\` to `\`
Update `lang_en_no.txt`
Enable Norwegian translation in `config.h`

Tested on MK404 MK3S
2022-05-24 07:28:10 +02:00
Guðni Már Gilbert
65d500f2ed Simplify printer_smodel_check
Saves 140 bytes of flash and 4 bytes of SRAM
2022-05-22 17:57:47 +00:00
Yuri D'Elia
d53eb69150 Manually cast to int when comparing against extrude_min_temp
Avoid the automatic conversion to float to improve code size.
2022-05-12 12:20:54 +02:00
Yuri D'Elia
ea46402e4d Replace EXTRUDE_MINTEMP with the configurable extrude_min_temp
Everywhere MINTEMP is checked, use the configurable value set by M302,
not an hardcoded value.

EXTRUDE_MINTEMP is now used only as the initial default value.

Reduce the precision of extrude_min_temp to an integer to reduce the
generated code size (constant folding did in fact do the same previously
anyway). Having tenths of degrees is not necessary for this feature.
2022-05-11 20:07:38 +02:00
Yuri D'Elia
64f646a8a4 Add notices about Sheet::bed_temp and Sheet::pinda_temp being unused
There is a potential for 2*8 bytes of extra sparse eeprom space, plus a
few bytes saved if we remove the update calls, so add a notice that
these values are currently only written-to, but never actually used.
2022-05-11 11:15:36 +02:00
Alex Voinea
7515db1ef0 Adjust comments 2022-05-02 10:02:00 +02:00
Alex Voinea
0b23ccdee9 Abort arc on planner hard stop 2022-04-29 20:38:48 +02:00
Yuri D'Elia
5b3441b2bd Fix AMBIENT_RAW_*_TEMP define names
The max/min temperature check were incorrectly using
HEATER_AMBIENT_RAW_*_TEMP (non-existing) instead of the correct
AMBIENT_RAW_*_TEMP (this is not a heater afterall).

This doesn't change the current behavior, since the check defaulted to
the correct path for the MK3+ configuration anyway.
2022-04-29 16:54:39 +02:00
FormerLurker
bb33c76d2b Fix and simplify M214 data types and default config initialization. 2022-04-28 14:36:51 +02:00
FormerLurker
02b0307307 Code Cleanup 2022-04-28 14:36:51 +02:00
FormerLurker
623c029bfa Code cleanup to reduce program storage 2022-04-28 14:36:51 +02:00
FormerLurker
acc234b0c5 Fix config store load (was missing n_arc_correction). 2022-04-28 14:36:51 +02:00
FormerLurker
3880777691 Fix invalid bool compare. 2022-04-28 14:36:51 +02:00
FormerLurker
6fc8155cbe Add n_arc_correction and enhanced small angle sin/cos approximation. 2022-04-28 14:36:51 +02:00
FormerLurker
58d9916d54 Make suggested corrections. 2022-04-28 14:36:51 +02:00
FormerLurker
4aa5a75301 Enhance arc interpolation and add M214 for controlling arc interpolation settings. 2022-04-28 14:36:51 +02:00
Alex Voinea
e3f48ead9f
Merge pull request #3440 from gudnimg/optimise-checkFanSpeed
Optimise `checkFanSpeed()` Flash use
2022-04-21 14:04:23 +02:00
Alex Voinea
d860d61513
Merge pull request #3459 from gudnimg/remove_pid_add_extrusion_rate
Remove unused setting `PID_ADD_EXTRUSION_RATE`
2022-04-21 14:01:50 +02:00
Alex Voinea
d4d8149c9b
Merge pull request #3438 from leptun/MK3_reset_acceleration_rates_on_steps_per_mm_change
Reset acceleration rates when changing microstepping resolution
2022-04-21 13:59:55 +02:00
Alex Voinea
a4887b542f
Merge pull request #3467 from gudnimg/autostart_stilltocheck-optimisation
Optimise `autostart_stilltocheck` variable
2022-04-21 13:57:02 +02:00
Guðni Már Gilbert
bf38241afe Make M117 message persistent when using G4 command
This is also supported in Marlin 2 FW

Fixes #1443
Fixes #2970
2022-04-18 17:07:34 +00:00
Guðni Már Gilbert
727060ddd8 Replace CustomMsg::MsgUpdate with CustomMsg::M117
MsgUpdate was only used with M117, renaming the message type to M117 may be more descriptive for current use case.
2022-04-17 15:01:48 +00:00
Guðni Már Gilbert
c77b768fdd Make M117 custom message persistant if print is paused
If M117 is called before M601 then we would like the custom message to
be visible on the LCD screen until the print is resumed.

Change in memory: +10 bytes of flash

Fixes #3316
2022-04-17 14:00:41 +00:00
Alex Voinea
b5f6bbb2c3 XFlash upload message 2022-04-15 12:37:51 +02:00
3d-gussner
312f3070c2 Use/show help.prusa3d.com instead of howto.prusa3d.com 2022-04-13 13:33:26 +02:00
Yuri D'Elia
765fbd3e92 Fix argument of lcd_selftest_fan_auto to be uint8_t 2022-04-11 17:42:31 +02:00
Guðni Már Gilbert
15b41e7348 Optimise autostart_stilltocheck variable
Make the variable static within the checkautostart function.
When the function is called for the first time autostart_stilltocheck
is set to true and will continue to live after the function is exited.
After it is set to false within checkautostart() it will continue to be
false forever.

Using static this way is more efficient than using a global variable

Saves 6 bytes of flash and 1 byte of SRAM
2022-04-09 11:10:55 +00:00
Alex Voinea
b52597f1b2
Merge branch 'MK3_3.11.1' into MK3_3.10.2 2022-04-07 14:05:34 +02:00
D.R.racer
6b6e06695f Version changed (3.11.0 build 4955) 2022-04-07 09:38:13 +02:00
Yuri D'Elia
859aa4d283 Reuse M123 during fan selftest to report RPM
M123 reports both fan speeds nicely in RPM, as well as the requested PWM
for each so that we don't need to show the test "number" to distinguish
between the two in the serial output.
2022-04-04 23:29:52 +02:00
Yuri D'Elia
7671ff37a9 Fix/optimize fan selftest
Rewrite the part of the fan selftest to use a shared path between hotend
and print fan.

Remove the useless 10 seconds spin-up delay for the print fan. Reduce it
to 5 seconds.

Properly wait for readings after spin-up, so that RPMs are more
reliable. Also tune the print fan threshold to a more reasonable
default. Both, in conjunction, now avoid the "swapped fan" check that
was incorrectly triggered in almost every case.
2022-04-04 21:36:02 +02:00
Guðni Már Gilbert
c62c412cc3 Remove unused setting PID_ADD_EXTRUSION_RATE
Even if the setting was turned on, it doesn't do anything useful.
2022-03-30 19:03:41 +01:00
Yuri D'Elia
1949802bea Cleanup: remove unused FILAMENT_RUNOUT_SUPPORT define
FILAMENT_RUNOUT_SUPPORT has never been supported in the MK3 branch, and
contains a ton of horrible and unmaintained code that doesn't even
compile anymore.

Since this code is currently polluting a sizable block inside the G0/G1
code block, simply get rid of it.
2022-03-30 12:49:08 +02:00
Yuri D'Elia
d724eb1f92 Cleanup hardcoded values to constants in M701 2022-03-30 12:33:46 +02:00
Yuri D'Elia
6317a6147d Use a consistent distance/feedrate for the [auto]load sequence 2022-03-30 11:38:25 +02:00
3d-gussner
4752b2b479 Disable Norwegian 2022-03-23 10:18:16 +01:00
3d-gussner
85a5986e9e Update ////MSG... for lang-add.sh 2022-03-16 09:01:14 +01:00
Guðni Már Gilbert
7f751ae6ac Add M201 paramters to documentation
Also fixed the reprap link for M201
2022-03-13 15:53:51 +00:00
Guðni Már Gilbert
8e2d44987f Document M203 parameters 2022-03-13 15:49:38 +00:00
Guðni Már Gilbert
935458beca Add 'E' parameter to M701 documentation
Remove missing 'U' parameter in M702
2022-03-13 12:04:26 +00:00