Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More oled ui control #99

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

More oled ui control #99

wants to merge 11 commits into from

Conversation

ErikDeBruijn
Copy link
Contributor

Feel free to comment. I've done some initial test and it seems to work, however don't consider this battle tested firmware! :) My testing was of the progress bar was before I multiplied the percentage (integer) by 1.2. While it doesn't give a compilation error I'm not sure whether the scaling to the progress bar size actually works but I have no UM2 here to test this with currently.

image

As you can see in the picture, I'm still dealing with the annoying checksums also being displayed if I display text through M10001 X[x] Y[y] S[text]. If anyone knows how to not display these, that's great.

Still figuring out whether to use this or emulating it through the GCodes above. In this case dynamic text (through GCodes) might be difficult.
@TinkerGnome
Copy link
Contributor

I'm not sure whether the scaling to the progress bar size actually works

lcd_progressbar awaits values between 0 and 124 (the pixel width)

...checksums also being displayed ... If anyone knows how to not display these, that's great.

Borrow some code from M23 (e.g.):

if (code_seen('S'))
{
    starpos = (strchr(strchr_pointer,'*'));
    if(starpos!=NULL) *(starpos)='\0';
    lcd_lib_draw_string_center(y, strchr_pointer + 1);
}

…use I instead of S for inverted text, e.g. M10008 X10 Y10 S48656c6c6f2c20776f726c6421 displays "Hello, world!"
Fixes the text feature to display text without appending checksum (e.g. "*127"!)
Also, allows inverted strings with M10001 Istring.
Terminate with a null byte to prevent characters from earlier strings to be displayed.
@ErikDeBruijn
Copy link
Contributor Author

@TinkerGnome Thanks, managed to fix the checksum problem! (and more). See also the newest commits if you're interested!

case 10008://M10008 - Display string at X,Y based on hex encoded chars (S), use I instead of S for inverted text,
// e.g. M10008 X10 Y10 S48656c6c6f2c20776f726c6421 displays "Hello, world!"
{
uint8_t x = 0, y = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code should also clear out the '*' character, to prevent the hex2bin function trying to convert that.

@robinmdh
Copy link
Member

robinmdh commented Apr 5, 2016

you're actualy drawing on the screen trough gcode, this seems odd to me wouldn't it make more sense to generate the UI in marlin and send statistics?

@ErikDeBruijn
Copy link
Contributor Author

@robinmdh yes, I have a specific need for it but it's really a generic capability that different people can use for their own use case. They can integrate a third party product much more nicely. E.g. Doodle3D can use this very well as well.

I'd love to see this merged but I'm not capable (yet) of implementing the feedback For an odd string length the string terminator will be set one byte too short.. Unless I would focus my time on getting better at embedded development. @robinmdh , could you help get this merged so it can go downstream?

This should fix the biggest objections to this branch/pull reqest.
If this was not marlin code for instance: all the magic values such as the 22 and 125 should be derived/defined or explained, etc.

Signed-off-by: Robin den Hertog <[email protected]>
@robinmdh
Copy link
Member

robinmdh commented Apr 6, 2016

@ErikDeBruijn made a very much untested fix of the items mentioned by @ckielstra also grabbed the updated hex2bin function from after testing and review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants