Guðni Már Gilbert
e62bc4686f
Replace hardcoded values and optimise strings
...
This commit saves 64 bytes of flash memory on my end
2022-02-05 18:28:17 +00:00
Guðni Már Gilbert
19dc05597d
Fix identation in PR
...
Also combined the if statements that check farm_mode
If farm_mode is 0xFF then we can skip the next if statment.
No change in memory footprint
2022-02-05 11:24:04 +00:00
Alex Voinea
274f198188
Fix typo from long ago
2022-02-04 16:28:49 +01:00
Alex Voinea
58867f6c06
Fix arduino 1.8.13 warnings
2022-02-04 15:53:49 +01:00
Alex Voinea
f068c3258f
Pack endstop flags
2022-02-04 15:24:43 +01:00
Alex Voinea
21a0b53647
remove firstrun
2022-02-04 13:27:43 +01:00
Alex Voinea
858984ef35
SD sorting entries instead of positions
2022-02-04 10:47:56 +01:00
Guðni Már Gilbert
1f3640ab26
Merge branch 'MK3_3.12_Optimizations' of https://github.com/leptun/Prusa-Firmware into MK3_3.12_Optimizations
2022-02-02 20:49:41 +00:00
Guðni Már Gilbert
43bf33e791
Optimise usage of code_value()
...
code_value() is float but in some cases we can save memory when the expected output is only 1 or 2 bytes.
Changes save 182 bytes of flash memory on my end.
2022-02-02 20:48:36 +00:00
Alex Voinea
f25bddce35
Simplify GETPC()
2022-02-02 21:06:58 +01:00
Alex Voinea
6ce7792045
Remove "hh" in fmt where it makes no difference
2022-02-02 20:58:21 +01:00
Guðni Már Gilbert
146b008186
Remove redundant variable farm_status
...
It is unused and status_number variable can be used instead.
2022-02-02 18:37:55 +00:00
Guðni Már Gilbert
459570ab66
Change prusa_stat_printerstatus parameter to uint8_t
...
Also changes status_number global variable to uint8_t
Changes save 80 bytes of flash and 1 byte of SRAM (Arduino IDE 1.8.19)
2022-02-02 18:35:52 +00:00
Guðni Már Gilbert
e525bcb7f5
Optimise lcd_selftest_screen input parameters and return type
...
* _progress_scale is max 3 so it can be uint8_t
* _progress is max 6 so it can be uint8_t
* Change _delay type to uint16_t to be explicit
Changes save 102 bytes of flash memory (Arduino IDE 1.8.19)
2022-02-01 18:57:43 +00:00
Guðni Már Gilbert
8681d84c44
Merge branch 'MK3_3.12_Optimizations' of https://github.com/leptun/Prusa-Firmware into MK3_3.12_Optimizations
2022-02-01 18:37:57 +00:00
Guðni Már Gilbert
53dfcf9d6f
Optimise if-statments in world2machine_clamp
...
Only one of the statements can be true: tmpx < X_MIN_POS or tmpx > X_MAX_POS.
So we can be a little bit smarter here and skip the second if statement if the first was true.
This saves 6 bytes of flash memory and potential some clock cycles
2022-02-01 18:37:41 +00:00
Alex Voinea
aec2db7683
Optimize MUL8x16R8
2022-02-01 18:12:13 +01:00
Guðni Már Gilbert
c0e7e17fc3
Fix type of nrFiles
2022-01-30 13:07:09 +00:00
Alex Voinea
1523194d3b
Fix build (merge conflict)
2022-01-30 13:18:07 +01:00
Alex Voinea
67e6361ff1
Fix temperature runaway variable types (merge conflict)
2022-01-30 13:16:05 +01:00
Guðni Már Gilbert
9bf45773f9
Merge remote-tracking branch 'upstream/MK3' into rebase-testing-ground-v2
2022-01-30 11:43:16 +00:00
Alex Voinea
aae562e480
Fix G81 for loop
2022-01-30 11:39:29 +00:00
Guðni Már Gilbert
c081e1a5ae
Loop index can be unsigned
...
Saves 4 bytes of flash memory
2022-01-30 11:39:29 +00:00
Guðni Már Gilbert
49693a9fb3
Remove undefined function
...
No change in memory footprint.
2022-01-30 11:39:29 +00:00
Guðni Már Gilbert
c705d4aa10
Change set_z() parameters to uin8_t
...
Saves 24 bytes of flash
2022-01-30 11:39:28 +00:00
Guðni Már Gilbert
581188ce2c
Fix an issue found in code review
...
Unfortunately this increases flash usages by 212 bytes (same usage as in current release) It seems it is most memory effcient to use int16_t (int). int8_t requires more memory.
2022-01-30 11:39:28 +00:00
Guðni Már Gilbert
f8847edca6
Remove one unused variable
...
Saves 1 byte of SRAM
The variable is only assigned a value but is never used.
2022-01-30 11:39:28 +00:00
Guðni Már Gilbert
d8723c0eac
Use code_value_uint8() in get_command()
...
The if statement is simplified as the value is never negative
and we can get rid of one variable
Saves 12 bytes of flash memory
2022-01-30 11:39:27 +00:00
Guðni Már Gilbert
ac049c7e3c
Use code_value_short() in get_command()
...
Same code but uses a defined function
Saves 28 bytes of flash memory
2022-01-30 11:39:27 +00:00
Guðni Már Gilbert
052ecc3782
G81: Change for loop variables x and y to uint8_t
...
Saves 198 bytes of flash, that's crazy
2022-01-30 11:39:27 +00:00
Guðni Már Gilbert
7787f17139
Smaller code in G28
...
Replace two blocks of code with already defined functions.
Change saves 100 bytes of flash memory and 11 lines of code.
2022-01-30 11:39:27 +00:00
Guðni Már Gilbert
b835f31904
Remove variable move_menu_scale
...
The variable is just set to 1.0 and is never modified, I also
removed the function lcd_move_menu_1mm()
Changes save 96 bytes of flash memory and 4 bytes of SRAM
2022-01-30 11:39:27 +00:00
Guðni Már Gilbert
a940c364c9
Create enum class for heating_status variable
2022-01-30 11:39:27 +00:00
Guðni Már Gilbert
2013295f94
Change farm_timer to uint8_t
...
Remove extern declaration of farm_timer and farm_status as they
are only used in one file.
Saves 26 bytes of flash
2022-01-30 11:39:26 +00:00
Guðni Már Gilbert
a687173e02
Change custom_message_state_old and custom_message_state to uint8_t
...
I see max value as 7*7+10 = 59
Saves 100 byte of flash and 1 byte of SRAM
2022-01-30 11:39:26 +00:00
Guðni Már Gilbert
60c9640602
Change heating_status_counter to uint8_t
...
It has a max value of 14
Saves 28 bytes of flash and 1 byte of SRAM
2022-01-30 11:39:26 +00:00
Guðni Már Gilbert
22f23dff36
Change heating_status to uint8_t
...
Saves 66 byte of flash and 1 byte of SRAM
2022-01-30 11:39:26 +00:00
Guðni Már Gilbert
2d614a8d41
Change usb_printing_counter to uint8_t
...
It is assigned max value of 10
Saves 26 byte of flash and 1 byte of SRAM
2022-01-30 11:39:26 +00:00
Guðni Már Gilbert
aa0a86bf13
Remove internal Prusa command 'Beat'
...
It doesn't seem to do anything.
Saves 22 bytes of flash
2022-01-30 11:39:25 +00:00
Guðni Már Gilbert
42778cae83
Remove unused kicktime timer
...
The variable is only set and never actually used
Saves 8 bytes of flash and 4 bytes of SRAM
2022-01-30 11:39:25 +00:00
Guðni Már Gilbert
ef8083a148
crashDetTimer can be ShortTimer
...
Expired value is less than 65535
Saves 8 bytes of flash and 2 bytes of SRAM
2022-01-30 11:39:25 +00:00
Guðni Már Gilbert
6a9bab02f7
Convert display_time to ShortTimer
...
Saves 24 bytes of flash, 1 byte of SRAM
2022-01-30 11:39:25 +00:00
Guðni Már Gilbert
802b8860c8
Convert mmu_last_finda_response to ShortTimer
...
Saves 48 bytes of Flash, 1 byte of SRAM
2022-01-30 11:39:25 +00:00
Guðni Már Gilbert
37fd9d1b11
Convert NcTime to ShortTimer
...
The variable is only used in ultralcd.cpp so I made it static there
and deleted it from Marlin_main.cpp
Saves 24 bytes of flash and 1 byte of SRAM
2022-01-30 11:39:25 +00:00
Guðni Már Gilbert
a1abd094dd
Convert autostart_atmillis to ShortTimer
...
Saves 34 bytes of flash and 1 byte of SRAM
2022-01-30 11:39:24 +00:00
Guðni Már Gilbert
762a5db125
Convert previous_millis_cmd to LongTimer
...
Saves 196 bytes of Flash but adds 1 byte of SRAM
2022-01-30 11:39:24 +00:00
Guðni Már Gilbert
1cd9ecb2c7
Convert mmu_last_request and mmu_last_response to ShortTimer
...
Saves 180 bytes of flash and 2 byte of SRAM
2022-01-30 11:39:24 +00:00
Guðni Már Gilbert
66782e9c9d
setTargetHotend expect an uint8_t, not int for second parameter
...
also change _usb_timer to ShortTimer
Saves 28 bytes of Flash and 1 byte of SRAM
2022-01-30 11:39:24 +00:00
Guðni Már Gilbert
77cce1fc05
Replace three lines by one function call which does the same thing
...
Saves 42 bytes of flash memory
2022-01-30 11:39:24 +00:00
Guðni Már Gilbert
a26651e7aa
Change return types of two functions uint8_t
...
These functions aren't used but they should return the appropriate type.
2022-01-30 11:39:24 +00:00
Guðni Már Gilbert
800f44509d
Change row_offsets[] to uint8_t
...
Saves 10 bytes of flash, and 4 bytes of SRAM
2022-01-30 11:39:24 +00:00
Guðni Már Gilbert
58213814cf
Replace for-loop with memcpy
...
Saves 22 bytes of flash memory
2022-01-30 11:39:23 +00:00
Guðni Már Gilbert
52aa5a5f00
Use inlined function set_destination_to_current() in more places
...
Saves 70 bytes of flash memory
2022-01-30 11:39:23 +00:00
Guðni Már Gilbert
a8d16d2949
Use memset to zero previous_speed array
...
Saves 150 bytes of flash memory
2022-01-30 11:39:23 +00:00
Alex Voinea
cdd7ea30f4
Fix LUT loop
2022-01-30 11:39:23 +00:00
Alex Voinea
fb10b4398e
Merge pull request #6 from gudnimg/gudni-PR1
...
Purged some `int`s for `uint8_t` when using the axis enum
2022-01-30 11:30:25 +00:00
Guðni Már Gilbert
f81db56793
temp_runaway_check() parameter _heater_id should be uint8_t
...
Saves 58 bytes of flash
2022-01-30 11:22:45 +00:00
Guðni Már Gilbert
261f311825
Change two arrays from int to uint8_t
...
__preheat_counter has max value of 16
__preheat_errors has max value of 5
Saves 58 bytes of flash memory and 4 bytes of SRAM
2022-01-30 11:22:45 +00:00
Guðni Már Gilbert
7535fa3a44
Remove unused variable
...
Saves 2 bytes of SRAM
2022-01-30 11:22:45 +00:00
Voinea Dragos
623762bd50
Fix build
2022-01-30 11:22:44 +00:00
Voinea Dragos
42a5f7dc20
Fix M226
2022-01-30 11:22:44 +00:00
Voinea Dragos
4aae88afdf
M42 optimization
2022-01-30 11:22:44 +00:00
Voinea Dragos
a5cd99a917
Disable unimplemented PID_ADD_EXTRUSION_RATE
2022-01-30 11:22:44 +00:00
Voinea Dragos
9951e3da52
Sound enums as uint8_t
2022-01-30 11:22:44 +00:00
Voinea Dragos
6dd59985ee
Disable PRUSA M28
2022-01-30 11:22:44 +00:00
Voinea Dragos
f22b9260ae
Fix build
2022-01-30 11:22:44 +00:00
Voinea Dragos
9abae2fd97
Remove maxlimit_status
2022-01-30 11:22:43 +00:00
Voinea Dragos
9684806e00
Change arduino IO to fastio where possible
2022-01-30 11:22:43 +00:00
Voinea Dragos
42c393764f
Adjust temperature runaway extruder count
2022-01-30 11:22:43 +00:00
Voinea Dragos
78362419da
nIRsensorLastTime
2022-01-30 11:22:43 +00:00
Voinea Dragos
a5f1f23fe2
TimeNow && TimeSent
2022-01-30 11:22:43 +00:00
Voinea Dragos
f64c6c2a39
Remove unused Stepper.cpp variables
2022-01-30 11:22:43 +00:00
Voinea Dragos
9d1e54e685
Tmc2130 use ShortTimer instead of custom timer implementation
2022-01-30 11:22:43 +00:00
Voinea Dragos
d8a14842c5
Remove unused skip_debug_msg
flag
2022-01-30 11:22:43 +00:00
Guðni Már Gilbert
63c6373f8d
Remove TEMP_STAT_LEDS from firmware
...
This isn't used by MK3 printers.
It seems to be leftover code from Marlin
2021-12-25 09:41:50 +00:00
DRracer
0be90dc5d1
Merge pull request #3320 from prusa3d/MK3_3.10.1
...
Merge MK3_3.10.1 into MK3 after release
2021-12-17 14:02:13 +01:00
D.R.racer
caca7bb9b8
Version changed (3.10.1 build 4697)
2021-12-16 12:14:02 +01:00
3d-gussner
1c1e69e555
Update FW crash message
2021-12-16 11:23:44 +01:00
3d-gussner
785d94ab3a
Add links to RepRap Gcode wiki for new Dcodes D20-D23
2021-12-16 09:32:38 +01:00
Yuri D'Elia
3849f9785a
Make cancel_heatup also abort cooldown in M190
...
This matches the expected behavior, as already implemented in
wait_for_heater().
2021-12-10 01:51:43 +01:00
Yuri D'Elia
320835a1b7
Do not cancel wait-for-temperature loops in disable_heaters()
...
Partially revert previous change: cancelling a single loop would often
advance the gcode stream to the next wait-for loop if executed at the
beginning of an SD print, implicitly turning off the flag again.
Cancel the loop directly in UnconditionalStop() which stops the command
queue as well in an atomic way, handling this correctly.
2021-12-10 01:46:20 +01:00
Yuri D'Elia
32d8d892f5
Actually call UnconditionalStop() in Stop()->lcd_print_stop()
...
Remove incorrect check introduced during development.
2021-12-10 01:43:59 +01:00
Yuri D'Elia
83693bf4cc
Remove useless assignment in lcd_cooldown
...
The current filament action will be aborted by lcd_return_to_status()
2021-12-07 19:27:18 +01:00
Yuri D'Elia
78f856c8d6
Do not unconditionally overwrite the status message in check_file()
...
No function should touch the status message directly without checking
the message severity level first. Replace the strcpy_P with
lcd_setstatuspgm().
2021-12-07 19:27:18 +01:00
Yuri D'Elia
7ff117d0c4
temp_runaway_stop: remove spourious space in error message
2021-12-07 19:27:18 +01:00
Yuri D'Elia
36a7b5ca56
Avoid redundant checks in lcd_setalertstatus*
2021-12-07 19:27:18 +01:00
Yuri D'Elia
a3915b57b9
Improve temp_runaway_stop robustness
...
Remove most of the duplicated code inside temp_runaway_stop(),
making it identical to the other temperature handlers.
Move the lower-level functions required to stop the entirety of the
machine into UnconditionalStop(). Reuse this function inside
lcd_print_stop().
Set the LCD alert message before calling Stop(), as done in other safety
handlers, so that the error is visible while the printer is stopping.
This also avoids other temporary status messages to appear before
the real issue is shown and/or STEALING the first CRITICAL alert
level before we do.
2021-12-07 19:25:34 +01:00
Yuri D'Elia
57abffda1b
Update temperature-related error message to use LCD_STATUS_CRITICAL
2021-12-07 11:09:58 +01:00
Yuri D'Elia
fb025bba05
Introduce severity levels for alert messages
...
Use the internal lcd_status_message_level for multiple severity levels
of alert messages.
This is needed to distinguish between non-critical alerts (such as FAN
ERROR) from critical ones (any heater issue). During a failure
scenario, a critical error MUST NOT be overridden by a lower-level one.
As such LCD_STATUS_CRITICAL is currently used for all heater-related
errors that result in a safety full-stop.
2021-12-07 11:06:08 +01:00
DRracer
a7dfe4b523
Merge pull request #3305 from gudnimg/sd-card-lcdtimer-fix-gudni-v2
...
Fix issue when the SD card is inserted and the file menu may sometimes close immediately due to a timeout
2021-11-19 07:23:21 +01:00
Guðni Már Gilbert
be79e3791f
Fixes #3262
...
Make sure to call lcd_timeoutToStatus.start() when the SD card is inserted
into the printer after it was removed beforehand.
(cherry picked from commit 6795843f153aa064f087f80990419a946cdfe857)
2021-11-18 19:23:21 +00:00
Guðni Már Gilbert
13732f162b
Fix build error when TMC2130_SERVICE_CODES_M910_M918 is enabled
...
(cherry picked from commit 6ed4b79cc6685f31b6914881008e036424dab2eb)
2021-11-18 19:19:56 +00:00
Guðni Már Gilbert
6887f844d3
Merge branch 'prusa3d:MK3' into fix-pinda-thermistor-build-fail
2021-11-18 19:15:15 +00:00
Panayiotis-git
f8410d8f3c
Print temperatures only if filament loading is still active
2021-11-18 11:46:36 +02:00
Guðni Már Gilbert
05e0c1e1d3
Fix build error if PINDA_THERMISTOR is not defined
...
temp_cal_active variable is not defined in this scope
2021-10-12 21:52:19 +00:00
EV3R4
eff9cd9f21
Typo: M84 docs
2021-09-27 19:34:53 +02:00
Guðni Már Gilbert
cf8a16baa1
Remove one call to lcd_timeoutToStatus.start
...
Saves 8 bytes of Flash memory
This call is redundant and when moving between menus
it gets called multiple times which results in waste
of clock cycles.
lcd_timeoutToStatus.start() is called from menu_lcd_lcdupdate_func()
which is enough.
2021-08-21 14:34:02 +00:00
Guðni Már Gilbert
e6a7abf2c1
Change temp_runaway_timer from float to uint32_t
...
Saves 32 bytes of flash
Also change temp_runaway_error_counter from int to
uint16_t to be specific
2021-08-06 15:08:46 +00:00
Guðni Már Gilbert
db1e5a203b
Change temp_runaway_status from float to uint8_t and its enum
...
Saves 90 bytes of flash, and 12 bytes of SRAM
2021-08-06 15:03:35 +00:00
Guðni Már Gilbert
b716c208d7
Various optimisation to change int to uint8_t
...
This commit saves 174 bytes of flash memory
2021-08-03 22:42:01 +00:00