pimoroni-pico icon indicating copy to clipboard operation
pimoroni-pico copied to clipboard

partial_update doesn't seem to work on badger.

Open aaronw2 opened this issue 3 years ago • 1 comments

I am attempting to use partial_update on an area of the screen and instead of the width and height expected I see what looks like a shrunken area that is half the width with garbled data in it. This is using the Python code

My code is loosely based on badge.py but the function in question is:

def display_date_time(): rtc = machine.RTC() year, month, day, wd, hour, minute, second, _ = rtc.datetime() hm = "{:02}:{:02}".format(hour, minute) dmy = "{:02}/{:02}/{:04}".format(month, day, year) display.thickness(1) display.font("sans") date_time = "%s %s" % (dmy, hm) time_length = display.measure_text(date_time, DETAILS_TEXT_SIZE) x = LEFT_PADDING y = HEIGHT - (DETAILS_HEIGHT // 2) width = time_length height = DETAILS_HEIGHT//2 print("time %d,%d, w=%d, h=%d" % (x, y, width, height)) display.text(date_time, LEFT_PADDING, HEIGHT - (DETAILS_HEIGHT // 2), DETAILS_TEXT_SIZE)

display.update()

display.partial_update(0, HEIGHT - (DETAILS_HEIGHT // 2),
                       WIDTH - IMAGE_WIDTH, DETAILS_HEIGHT//2 - 1)

Note that if I do not use partial_update but use update instead then everything is OK. It would be nice if the API could be better documented.

aaronw2 avatar May 23 '22 05:05 aaronw2

Never mind, I found the issue, Y must be a multiple of 8.

aaronw2 avatar May 23 '22 08:05 aaronw2

Badger 2040 and Badger 2040 W now live here: https://github.com/pimoroni/badger2040/

Closing this issue since this caveat is covered in the updated (WIP in PR) docs.

Gadgetoid avatar Mar 09 '23 20:03 Gadgetoid