Commit Graph

118 Commits

Author SHA1 Message Date
Alex Voinea 9606c4f00b Add font unpacking documentation 2023-10-03 08:19:48 +02:00
Alex Voinea d53ba0eba2 Fix wrong character sent when potentially unused slot is replaced 2023-10-03 08:19:48 +02:00
Alex Voinea 32cee8b529 Move custom character type to lcd.cpp 2023-10-03 08:19:48 +02:00
Alex Voinea 8a39f53e26 Prevent out of bounds custom character font data 2023-10-03 08:19:48 +02:00
Alex Voinea 6703640c56 Optimize `lcd_print_custom()` 2023-10-03 08:19:48 +02:00
Alex Voinea a267d80fe2 Fix legacy build 2023-10-03 08:19:48 +02:00
Alex Voinea 10e6087d6b Update language scripts to use the font 2023-10-03 08:19:48 +02:00
Alex Voinea 09c85796a6 No need to mask the CGRAM data before sending 2023-10-03 08:19:48 +02:00
Alex Voinea 245a2852ac Font table compression 2023-10-03 08:19:48 +02:00
Alex Voinea 8e18c83d51 Update debug messages 2023-10-03 08:19:48 +02:00
Alex Voinea 4736a1624f First working implementation
Fix cherry-pick conflict
2023-10-03 08:19:48 +02:00
Alex Voinea 580b27e394 Use lcd_home() wherever possible
Fix cherry-pick conflict
2023-10-03 08:19:48 +02:00
Alex Voinea c7f9a46c86 Cleanup around invalidating the custom characters 2023-10-03 08:19:48 +02:00
Alex Voinea 60494b20e8 lcd_print_custom(): limit searching to lcd_custom_index 2023-10-03 08:19:48 +02:00
Alex Voinea 7e0ab44d09 Refactor the lcd_print_custom() method 2023-10-03 08:19:48 +02:00
Alex Voinea 90222747f2 lcd_set_cursor_column() also updates lcd_ddram_address 2023-10-03 08:19:48 +02:00
Alex Voinea 100a8e3b33 Dynamic characters initial
Fix more hardcoded characters

Finally optimize the lcd printf with custom characters

FontGen.py script

Add arguments and action

Fix build

Fix conflicts
2023-10-03 08:19:48 +02:00
Guðni Már Gilbert 63775dfabb PFW-1504 fix conflicting UI issues
Proposal to fix some of the issues with the initial implementation
it is safer to use the status line code to print the message so
there aren't any conflicts in the LCD cursor position.

Allow inserting a byte into any position in the LCD status message

Also, add a variable to control from which index in the array
should the message start printing. This is very useful for progress
bars and messages which continually update. I think we can save some
memory by applying this to Mesh Bed Leveling later.

Change in memory:
Flash: +106 bytes
SRAM: +1 byte
2023-07-27 16:44:34 +00:00
Guðni Már Gilbert 6623d45af9 optimisation: Tighter LCD timing
Author: leptun

Change in memory:
Flash: -14 bytes
SRAM: 0 bytes
2023-07-25 15:02:49 +00:00
Alex Voinea a354aad762
Merge pull request #4167 from leptun/lcd_encoder_improvements
Lcd encoder improvements
2023-04-24 15:58:54 +02:00
Alex Voinea c339711025
Make the encrot table balanced
It won't change much. It is not possible to determine in which direction the encoder spun when two steps are made, so just use + or - 2.
2023-04-24 11:56:25 +02:00
Alex Voinea 32e68c33b4
lcd encoder: use lookup table
Also handle the scenario where the encoder moves two steps in a single lcd_buttons_update cycle.

Flash: -46B
SRAM: 0B
2023-04-24 11:56:13 +02:00
Alex Voinea ea101f49d4
`lcd_buttons` is actually `lcd_click_trigger`
Flash: -4B
SRAM: 0B
2023-04-24 11:56:04 +02:00
Alex Voinea dd16cf4525
Remove Binary.h include 2023-04-24 11:52:25 +02:00
Alex Voinea 17e085040c
Add missing line to custom character
Shouldn't make a difference since the array is already defined as 8B long, but I just found it weird and surprising when I noticed only 7 lines were defined
2023-04-24 10:44:48 +02:00
Alex Voinea 548ed0eb31
Convert <binary.h> to native binary literals 2023-04-24 10:42:09 +02:00
Alex Voinea 5778e39687
Resync `lcd_encoder_diff` when clicking
Flash: +4B
SRAM: 0B
2023-04-23 10:07:52 +02:00
Alex Voinea c037e6dfba
Use atomic block for accessing lcd_encoder_diff
There was still the possibility of lcd_encoder_diff being updated from the ISR while the new enc_diff was being computed.

Flash: +8B
SRAM: 0B
2023-04-23 09:58:56 +02:00
Alex Voinea 1f181a949a
Fix `lcd_encoder_diff` getting out of sync with the knob hard steps
Flash: +18B
SRAM: 0B
2023-04-23 09:48:09 +02:00
Guðni Már Gilbert ccabf1fa31 Remove random //-// comments 2023-04-22 13:39:08 +00: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
D.R.racer dfe6ea6470 Fixup after rebase 2023-04-06 07:44:16 +02:00
Guðni Már Gilbert 062ea1cf25 optimisation: make lcd_encoder two bytes (int16_t)
lcd_encoder was int32_t (4 bytes) because of the menu code
when editing through the menus, the menus only accept
int16_t so it doesnt make sense to use int32_t.

Change in memory:
Flash: -892 bytes
SRAM: -2 bytes
2023-04-06 07:44:16 +02:00
Guðni Már Gilbert ffc34edf4c Pull in changes from PR 4080
Additionally make lcd_encoder_bits static
since it's not used outside the ISR context
2023-04-05 10:30:59 +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 0cac7612db optimisation: Always make sound when knob is clicked or rotated
This commit adds the ability for firmware to make sounds when the
knob is clicked or rotated, when LCD updates are disabled.

The improvement here is the sound is being made with one line of code
whether or not LCD updates are enabled or disabled.

Change in memory:
Flash: -24 bytes
SRAM: 0 bytes
2023-04-05 10:30:59 +02:00
Guðni Már Gilbert 8a926fad10 backlight: set rotation flag when certain amount of pulses are detected
We don't want to trigger a backlight wakeup randomly, for example
due to background noise.
2023-02-20 18:26:43 +00:00
Guðni Már Gilbert db878c9996 backlight: always allow backlight to dim/wake
This commit adds the ability for the firmware to dim and wake the
backlight when LCD updates are disabled. Such as in the MMU error screen
or when rendering full screen messages which typically
disable the LCD updates to prevent the status screen from rendering.

Fixes #2777

Change in memory:
Flash: -26 bytes
SRAM: +1 byte
2023-02-18 17:08:35 +00:00
Guðni Már Gilbert da63d73585 optimisation: don't print floats with lcd_print()
Change in memory:
Flash: -442 bytes
SRAM: 0 bytes
2023-01-25 18:21:22 +00:00
Guðni Már Gilbert a5f7f1d735 optimisation: change index from uint32_t to uint8_t
Change in memory:
Flash: -152 bytes
SRAM: 0 bytes
2023-01-25 18:21:22 +00:00
Guðni Már Gilbert d83c0f6c40 Fix an issue with indexing PROGMEM pointer
Using array index 'pointer[index]' doesn't work properly.
Instead using "pointer + index" works fine.

No change in memory footprint
2023-01-16 12:36:57 +01:00
Guðni Már Gilbert 9416310f7e optimisation: move row_offsets into PROGMEM
Change in memory:
Flash: -42 bytes
SRAM: -4 bytes
2023-01-16 12:36:57 +01:00
Guðni Már Gilbert eeb5f3d50c optimisation: refactor menu_draw_P()
Add a way to only change the LCD column

Change in memory:
Flash: -90 bytes
SRAM: 0 bytes
2023-01-16 12:36:57 +01:00
Guðni Már Gilbert 730bb3708e Fix an issue with menu_draw_item_puts_P
Change in memory:
Flash: +16 bytes
SRAM: 0 bytes
2023-01-16 12:36:57 +01:00
Guðni Már Gilbert cc08b938b7 Optimisations: implement lcd_print_pad_P()
Used lcd_print_pad_P is some obvious places. We can probably use
this function in more places to further save flash memory

Change in memory:
Flash: -268 bytes
SRAM: 0 bytes
2023-01-16 12:36:57 +01:00
Guðni Már Gilbert 184e19dd60 further optimise lcdui_print_status_line
We can use lcd_print_pad to determine
whether the end of the file name was reached

lcd_print_pad now returns the last character pointed to.
If the end of the string was reached, it will be the null delimeter which
evaluates to "false" in an if statment (same as NULL).
Else "true" means the end of the string was not reached.

Change in memory:
Flash: -42 bytes
SRAM: 0 bytes
2022-11-13 09:29:37 +01:00
Yuri D'Elia 709d07310a lcd_print_pad: do not overflow len when truncating the string 2022-09-26 11:26:10 +02:00
Yuri D'Elia 80c06bda55 Improve warning behavior during thermal anomaly
The current code forces any warning to return the user to the status
screen in order to show the message.

Thermal anomaly warnings can repeat at very short intervals, making menu
navigation (to pause/tune the print) impossible.

We now check if the message to be displayed is the same and only force a
kickback for new messages.

This partially reverts https://github.com/prusa3d/Prusa-Firmware/pull/3600
since we need the string to be null terminated for ease of comparison.

We pad the status line at display time instead using the new
lcd_print_pad() function which achieves the same effect.
2022-09-22 16:12:35 +02:00
Guðni Már Gilbert f6fd91a235 Optimise lcd_status_screen
Saves 20 bytes of flash
2022-07-27 11:14:18 +00:00