Commit Graph

1808 Commits

Author SHA1 Message Date
Alex Voinea e516d8a0c4
Merge pull request #4156 from leptun/lcd_status_screen_block
Fix `M0` click not consumed
2023-04-22 15:01:16 +02:00
Guðni Már Gilbert 4ce3fa53a1 Optimise M0/M1 code size
Replace two bool variables with one.

It's not obvious but (!hasP && !hasS) is equal to
!(hasP || hasS)

Note: expiration_time_set = hasP || hasS
Truth table:
|--------------------------------------------------|
| hasP| hasS| (!hasP && !hasS)|  !(hasP || hasS) |
|------|-----|--------------------|-----------------|
|   0    |  0   |               1            |            1           |
|   0    |  1   |               0            |            0           |
|   1    |  0   |               0            |            0           |
|   1    |  1   |               0            |            0           |
|--------------------------------------------------|

Change in memory:
Flash: -36 bytes
SRAM: 0 bytes
2023-04-21 17:42:55 +00:00
Alex Voinea 91b913e997
Fix `M0` click not consumed
Fix the need to click the knob twice to dismiss `M0`.

Flash: -54B
SRAM: -2B
2023-04-21 12:59:40 +02:00
Guðni Már Gilbert 18c389543b Fix lcd_update() FW crashes
Change in memory:
Flash: +10 bytes
SRAM: 0 bytes
2023-04-19 15:41:36 +00:00
Alex Voinea 2dcaae80d5
Merge pull request #4027 from gudnimg/minor-optimisation-gudni
Many minor optimisations for 3.13/3.14
2023-04-17 21:27:48 +02:00
Alex Voinea ea97ca7920
Use `EXTRUDERS` instead of hardcoded value in string 2023-04-17 21:12:59 +02:00
Alex Voinea b67063f14a
Remove empty lines 2023-04-17 21:10:20 +02:00
Guðni Már Gilbert 43d41ddd2b cleanup: static variables in Marlin_main.cpp 2023-04-16 23:23:31 +00:00
Guðni Már Gilbert 01df65882f cleanup: remove commented code 2023-04-16 15:25:43 +00:00
Guðni Már Gilbert 9b6e1babcb many more lcd_putc_at optimisations
Changes in
lcd_implementation_drawmenu_sdfile
and
lcd_implementation_drawmenu_sddirectory
seem to save the most.

Change in memory:
Flash: -72 bytes
SRAM: 0 bytes
2023-04-15 13:45:10 +00:00
Guðni Már Gilbert 583c46a63f Simplify two fan_check_error checks
There are only 3 possible values. No need to check for two of them
to rule of the last value. Instead simply check for the last value only.

Change in memory:
Flash: -16 bytes
SRAM: 0 bytes
2023-04-15 13:45:10 +00:00
Guðni Már Gilbert b67c359129 Move fan_state to fancheck.cpp and make it static
No change in memory
2023-04-15 13:45:10 +00:00
Guðni Már Gilbert 7c23d8b00c cleanup: make cancel_heatup static in Marlin_main 2023-04-15 13:45:10 +00:00
Alex Voinea d148c08991 Remove dead code from get_coordinates() 2023-04-15 13:45:10 +00:00
Alex Voinea c7de1b1416 optimize get_coordinates() axis mask 2023-04-15 13:45:10 +00:00
Alex Voinea ea7b395852 Remove useless parantheses
Found these a few months ago when I was trying some other optimization. Don't want to make a PR just for this, so I'll just slide it here in this existing PR.
2023-04-15 13:45:09 +00:00
Guðni Már Gilbert 70dadc4202 M115: Extruder count is always 1
Change in memory:
Flash: -8 bytes
SRAM: 0 bytes
2023-04-15 13:45:09 +00:00
Guðni Már Gilbert 62cbc829f6 optimisation: use new eeprom methods in check_printer_version()
Change in memory:
Flash: -48 bytes
SRAM: 0 bytes
2023-04-15 13:45:09 +00:00
Guðni Már Gilbert 6e02a082e2 cleanup: make heating_status_counter static
Change in memory:
Flash: 0 bytes
SRAM: 0 bytes
2023-04-15 13:45:09 +00:00
Alex Voinea af4a3f3328
Reorder eeprom reads
Saves 4B of flash
2023-04-13 11:15:17 +02:00
Alex Voinea f333d36e47
Use a different location as a kill message pending flag
The old implementation would fail if the message was in progmem at address 0xffff or 0x0000 (both unlikely). It would also fail if the eeprom was initialized to some other random value, which could have been dangerous when displayed as a full screen message.
2023-04-13 10:57:00 +02:00
Alex Voinea 4b65d49512
Move kill check earlier during startup 2023-04-13 10:57:00 +02:00
Alex Voinea f388d8abb6
postponed kill() message with softReset 2023-04-13 10:57:00 +02:00
Alex Voinea 82343184e7
Merge pull request #4036 from gudnimg/optimise-mmu-silent-mode
optimisation: MMU silent mode toggling & init
2023-04-13 10:54:21 +02:00
Guðni Már Gilbert 902780a929
Disable M351 when using TMC2130 and code related to it
Change in memory (MK3S+ multilang build)
Flash: -250 bytes
SRAM: 0 bytes
2023-04-07 21:07:26 +02:00
Guðni Már Gilbert 2ced00f21c Convert fanSpeed and saved_fan_speed to uint8_t
These variables only range from 0 to 255

For the menus we currently need to convert fanSpeed to int16_t.

Change in memory:
Flash: -160 bytes
SRAM: -2 bytes
2023-04-06 06:05:59 +02:00
Guðni Már Gilbert ee39cb4e90 remove one global variable 2023-04-05 11:16:54 +02:00
Guðni Már Gilbert 768319f1e7 optimisation: cleanup print statistics
Change in memory:
Flash: -104 bytes
SRAM: 0 bytes
2023-04-05 11:16:54 +02:00
Guðni Már Gilbert a7e9ccfb57 Major refactoring
Fixes all the issues I've found so far.

Roughly 60B of flash saved. Need to double check that later.
2023-04-05 10:30:59 +02:00
Guðni Már Gilbert d89e6de040 Update lcd_encoder in lcd_update
This fixes the spurious feedback when rotating the knob
because lcd_update is called much often than the interval
at which the lcd rendering is updated

Change in memory
Flash: -88 bytes
SRAM: -9 bytes
2023-04-05 10:30:59 +02:00
Guðni Már Gilbert 7de725f840 G80: Change 'correction' data type to int8_t
Valid values range from -100 to 100. Storing this value as four bytes
(int32_t) is not efficient.

Instead we can store G80 user input temporarily as int32_t and check
if the value is within the allowed range. If it is, then we convert the
int32_t (4 bytes) to int8_t (1 byte).

Change in memory:
Flash: -78 bytes
SRAM: 0 bytes
2023-04-05 10:13:27 +02:00
Guðni Már Gilbert 956efde822 G80: Re-implement optimisation from user espr14
Original Pull Request:
https://github.com/prusa3d/Prusa-Firmware/pull/3061

Change in memory:
Flash: -292 bytes
SRAM: 0 bytes
2023-04-05 10:13:27 +02:00
D.R.racer 7f921b4071 Limit some of the float formatting to fit 30 bytes buffer in enquecommandf_P 2023-04-05 09:10:39 +02:00
Guðni Már Gilbert b9ce7637df Rename enquecommandf() into enquecommandf_P() 2023-04-05 09:10:39 +02:00
Guðni Már Gilbert 7e119f733f Implement variant of enquecommand which accepts format string
This eliminates many local buffers

Change in memory:
Flash: -450 bytes
SRAM: 0 bytes
2023-04-05 09:10:39 +02:00
Guðni Már Gilbert 687c14808a optimisation: MMU silent mode toggling & init
Change in memory:
Flash: -16 bytes
SRAM: -2 bytes
2023-04-04 17:07:55 +00:00
3d-gussner 4cf46893fc Revert "Fix a few ambiguous overloaded calls"
This reverts commit b7c42e83cf.
2023-04-04 16:12:41 +02:00
Guðni Már Gilbert 46852e9941 M862: determine decimal through math rather than checking for null byte/pointer.
This way doesn't add any more flash memory.
Calculating the string length or checking for a null byte
will end up increasing flash consumption overall.
2023-04-04 15:22:21 +02:00
Guðni Már Gilbert 478627b6bc Simplify parsing M862
This gets rid of float conversion.
We just need to check the 6th character when M862 is detected. This
character gives us the digit after the dot.

Change in memory:
Flash: -20 bytes
SRAM: 0 bytes
2023-04-04 15:22:21 +02:00
Guðni Már Gilbert b9fecab239 Reduce calls to __divsf3 when calculating feedrate
For non-time critical code it is more effcient to call a function
rather inlining each division operation.

Change in memory:
Flash: -122 bytes
SRAM: 0 bytes
2023-04-04 15:16:56 +02:00
Guðni Már Gilbert b7c42e83cf Fix a few ambiguous overloaded calls
Noticed this when exploring another optimisation

By specification exactly which overloaded function to use
we save some memory

Seems to have something to do with doing arithmetic in the function argument

Change in memory:
Flash: -156 bytes
SRAM: 0 bytes
2023-04-04 15:03:48 +02:00
3d-gussner eb3421f0f2
Merge pull request #4021 from gudnimg/cleanup_crashdet_detected
cleanup: remove unnecessary LCD update in `crashdet_detected()`
2023-04-04 14:58:30 +02:00
3d-gussner 6dbf35f6e6
Merge pull request #4062 from gudnimg/cleanup_move_planned
remove duplicate function in planner
2023-03-24 14:06:19 +01:00
3d-gussner 6959b372ec
Merge pull request #4063 from gudnimg/PFW-1503
PFW-1503 Improve live Z babystep menu handling
2023-03-24 14:01:15 +01:00
3d-gussner 7e0bf88431 Use `G28 W` only 2023-03-22 12:30:16 +01:00
Guðni Már Gilbert 5643d16c01 cleanup: remove redundant lcd_update in cashdet_detected
There is no need to repeat:
lcd_update_enable(true);
lcd_update(2);

Also lcd_clear() is redundant because lcd_update(2) will clear the LCD

Change in memory:
Flash: -16 bytes
SRAM: 0 bytes
2023-03-18 19:52:08 +00:00
Guðni Már Gilbert bc27b71729 Pull one common G1 gcode into PROGMEM
Change in memory:
Flash: -32 bytes
SRAM: 0 bytes
2023-03-18 17:37:27 +00:00
Guðni Már Gilbert 6edd8b0719 Add M220 into PROGMEM
Change in memory:
Flash: -10 bytes
SRAM: 0 bytes
2023-03-18 17:09:43 +00:00
Guðni Már Gilbert 733bc874fb Move G28W0 to messages
No change in memory
2023-03-18 16:48:30 +00:00
Guðni Már Gilbert 129cc18cbf Add M23 %s into PROGMEM
Change in memory:
Flash: -14 bytes
SRAM: 0 bytes
2023-03-18 16:18:05 +00:00