Skip to content

Various LCD / backlight adjustments#26086

Merged
thinkyhead merged 54 commits intoMarlinFirmware:bugfix-2.1.xfrom
classicrocker883:bugfix-2.1.x-fix
Aug 25, 2023
Merged

Various LCD / backlight adjustments#26086
thinkyhead merged 54 commits intoMarlinFirmware:bugfix-2.1.xfrom
classicrocker883:bugfix-2.1.x-fix

Conversation

@classicrocker883
Copy link
Contributor

@classicrocker883 classicrocker883 commented Jul 17, 2023

Description

  • the range did not allocate difference between Max and Min (+/-) and used just one value for both +/-
    also added + to make difference of +/-

  • LCD_BACKLIGHT_TIMEOUT_MINS
    added support for DWIN type displays for LCD timeout (in mins).
    LCD display and timeout and turn off after a certain amount of time has passed - screen saver-esque.

  • in meshviewer, when it draws circles to indicate high or low spots on the bed, the circle colors have a more linear gradient - which is more true to how it should look, corresponding to values. also values aren't limited to 0.20. (fixed that).

  • in the more recent commit for ProUI, ADVANCE_PAUSE_FEATURE "#if" statements were rearrange / ommited so that the adv pause feature can be disabled yet still utilize the other menu pages / functions.

  • Updated CMakeLists.txt to stow warning for depreciated versions. Also added a "In case of..." / To Do If... comment.
    in WindowsPaths.cmake or UnixPaths.cmake in the CMake install directory, an error may appear saying unknown command _cmake_record_install_prefix(). I give a fix which simply has the user either comment out (#) that line, or add include(CMakeSystemSpecificInformation) above it which links to the file in which that function is defined.

  • Renamed PlotClass. Updated to fix spelling typo (grph => graph). Changed how graph is updated, in the graph each "block" amounts to (60/2) - 30 seconds of time rather than (50/2) - 25 seconds.

  • Updated proui/dwin.cpp Variable update interval, from 1024 to 1000 (ms) and 500 (ms). which updates the menu a bit faster, temp - fan speed - blink - plot graph...

Requirements

Benefits

-stated in description-
for context, this is what the fix looks like


as you can see, the high and low values are correct. -0.24.....0.22+ otherwise originally it would read -0.24.....0.24+

This also adds the ability to set a timeout for the LCD (PROUI), could be implemented in JyersUI and Creality_LCD.


***For SanityCheck, it was edited to quiet errors, not sure if these changes are the best but it should be reviewed.



The fix to dwinui.cpp for RainbowInt -- better readability/implement code, draws the color gradient with wider spectrum (more true to color >> value)* .

The fix to meshviewer.cpp allows it to draw the actual true value, instead it was limited to |0.20| on the View Mesh.

also fixed latest ProUI commit, rearrange ADVANCE_PAUSE_FEATURE functions so when it is disabled other functions like parkHead can be accessed.


most recent plot.cpp plot.h fixes typo, 30sec graph plot between white bars instead of 25sec.
remove redundant DWIN_UPDATE_INTERVAL / DWIN_VAR_UPDATE_INTERVAL, seperate the defined values to make better use. split
DWIN_VAR_UPDATE_INTERVAL to update display variables in half time (faster).

Configurations

#define LCD_BACKLIGHT_TIMEOUT_MINS can be uncommented - value of 10 for 10 minutes.

Related Issues

possible SanityCheck error compatibility with other configurations.

@classicrocker883 classicrocker883 changed the title Fix mesh viewer range, unused asymmetric Fix mesh viewer range, add LCD backlight timeout Jul 23, 2023
@classicrocker883 classicrocker883 changed the title Fix mesh viewer range, add LCD backlight timeout Fix mesh viewer range, add LCD backlight timeout, draws better "Rainbow" colors Jul 25, 2023
@classicrocker883 classicrocker883 changed the title Fix mesh viewer range, add LCD backlight timeout, draws better "Rainbow" colors 🔧Fix mesh viewer range, add LCD backlight timeout, draws better "Rainbow"‎️‍🌈 colors Jul 25, 2023
@thinkyhead
Copy link
Member

would msg.setf_P(PSTR("%02f"), z) work?

Keep in mind that we cannot use %f with these platforms. To print floats we must use dtostrf, which is handled by the MString class using float — or one of the wrappers, p_float_t or w_float_t to set a specific precision.

@thinkyhead thinkyhead force-pushed the bugfix-2.1.x-fix branch 2 times, most recently from 1500f9a to 6bc3df7 Compare August 23, 2023 01:19
@classicrocker883
Copy link
Contributor Author

would msg.setf_P(PSTR("%02f"), z) work?

Keep in mind that we cannot use %f with these platforms. To print floats we must use dtostrf, which is handled by the MString class using float — or one of the wrappers, p_float_t or w_float_t to set a specific precision.

@classicrocker883
Copy link
Contributor Author

classicrocker883 commented Aug 23, 2023

everything you changed is looking good. however a couple things needed to addressed, I did the necessary tweaks. had to omit and revert back the range for JyersUI/dwin.cpp line ~400. if say you went ahead and used rmin with rmax to define the color output for values, you don't get the expected gradient.

in this part of the function void drawBedMesh

      // Draw value square grid
      GRID_LOOP(x, y) {

I know this because I tested it that way, having rmin and rmax (as range and range2) it just doesn't work well. like the highest value should be the brightest color, however this way makes it not so, and another value below that will be brighter - so it gets very confusing.

@thinkyhead
Copy link
Member

thinkyhead commented Aug 24, 2023

I went ahead and cleaned up the gcode_preview.* code to address some things.

  • Move Preview_ functions into a static singleton class.
  • Define fileprop_t methods inside the struct.
  • Apply PSTR in case this code is ever deployed on AVR.
  • Return bool types in bool methods.
  • Use p_float_t instead of dtostrf for some strings.
  • Move thumbdata from the heap to the stack (assuming the stack can be very large).

@classicrocker883
Copy link
Contributor Author

I went ahead and cleaned up the gcode_preview.* code to address some things.

thanks for taking the time and doing that, its looking good, ill give it a test shot. quick question regarding the G-code preview feature, when selecting to view a file with a thumbnail more than once, following these steps:

  1. Go to Print menu
  2. Select any file w/thumbnail preview
  3. Cancel/return to file menu
  4. Repeat Step 2 and 3

depending on the file, you can do this twice or sometimes 3 or 4 times until it freezes/crashes and reboots.
however if you say go to another folder or select another file w/out a thumbnail preview, this sort of clears the cache and you can do this as many times as you like.

so obviously somewhere in memory where the image is stored it overloads, there should be a way to clear the cache or address when selecting Cancel instead of print. I've tried a few different things that haven't worked like delete[] fileprop.thumbnail

more about it here. #26169

while we are on the subject is there anything which may alleviate the situation?

@classicrocker883
Copy link
Contributor Author

just wanted to comment saying I updated the plot.cpp plot.h and made DWIN_VAR_UPDATE_INTERVAL useful in proui/dwin.cpp

@thinkyhead
Copy link
Member

while we are on the subject is there anything which may alleviate the situation?

I found one possible culprit. The buf64[] array allocates fileprop.thumbsize bytes, then loops until nread == fileprop.thumbsize, and then buf64[nread] = '\0'. That last step exceeds the buffer size. So I just patched that.

If this doesn't fix the problem then we should look further.

@thinkyhead thinkyhead merged commit 8fa6a4d into MarlinFirmware:bugfix-2.1.x Aug 25, 2023
@mriscoc
Copy link
Contributor

mriscoc commented Aug 27, 2023

Good PR! @classicrocker883 thanks for your contributions, feel free to port the features that you consider helpful from my fork to Marlin, I think that this will help me henceforth to fully focus in my fork.

mikezs added a commit to mikezs/Marlin that referenced this pull request Sep 8, 2023
* bugfix-2.1.x: (25 commits)
  [cron] Bump distribution date (2023-08-26)
  ✨ Mellow Fly E3 V2 (STM32F407VG) (MarlinFirmware#26081)
  🚸 Fixes for ProUI, JyersUI, backlight, etc. (MarlinFirmware#26086)
  🧑‍💻 Encapsulate ProUI G-code preview
  [cron] Bump distribution date (2023-08-25)
  🧑‍💻 Adjust LCD string draw (MarlinFirmware#26154)
  [cron] Bump distribution date (2023-08-24)
  📝 Thermistor info updates (MarlinFirmware#26202)
  [cron] Bump distribution date (2023-08-23)
  ✨ G-code 'T' report current tool (MarlinFirmware#26151)
  🔧 Allow arbitrary BLOCK_BUFFER_SIZE
  🔧 Fix Linear Leveling grid size sanity check (MarlinFirmware#26199)
  🚸 Avoid LCD messages starting with "Error:" (MarlinFirmware#26164)
  🩹 Fix FT Motion menu Back item (MarlinFirmware#26175)
  [cron] Bump distribution date (2023-08-22)
  ✅ Fix unused test
  🐛 Fixes for G2/G3 arcs (MarlinFirmware#26170)
  [cron] Bump distribution date (2023-08-21)
  🎨 FTDI cleanup
  [cron] Bump distribution date (2023-08-20)
  ...
Pragma8123 pushed a commit to Pragma8123/Bender that referenced this pull request Oct 24, 2023
EvilGremlin pushed a commit to EvilGremlin/Marlin that referenced this pull request Oct 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants