MicroPython Display Drivers part 2

@kdschlosser Hey man, have you successfully tested RGBBus? I’m testing it and it reboots in mp_lcd_rgb_bus_make_new with the following code:

from lcd_bus import RGBBus

display_bus = RGBBus(
    hsync=41,
    vsync=42,
    de=2,
    disp=-1,
    pclk=1,
    data0=11,  #r0
    data1=10,  #r1
    data2=9,  #r2
    data3=46,  #r3
    data4=3,  #r4
    data5=48,  #g0
    data6=47,  #g1
    data7=21,  #g2
    data8=14,  #g3
    data9=13,  #g4
    data10=12,  #g5
    data11=40,  #b0
    data12=39,  #b1
    data13=38,  #b2
    data14=0,  #b3
    data15=45,  #b4
#     freq=8_000_000,
#     bb_size_px=0,
#     hsync_pulse_width=2,
#     hsync_front_porch=46,
#     hsync_back_porch=44,
#     hsync_idle_low=False,
#     vsync_pulse_width=2,
#     vsync_front_porch=16,
#     vsync_back_porch=18,
#     vsync_idle_low=False,
#     de_idle_high=False,
#     pclk_idle_high=False,
#     pclk_active_neg=False,
#     disp_active_low=False,
#     refresh_on_demand=False,
#     bb_inval_cache=False,
)

A user sent me an RGB display to test but I have not gotten to testing it. I hurt my back and have been staying away from the PC.

I hope you get better @kdschlosser

Yes, same here.

It’s sore that’s for sure. I had the Mrs give me a good massage and that has helped a lot. It hasn’t taken care of all of the pain but at least is is kind of bearable.

I had to switch gears and focus my attention on downloading all of the property tax data from my county for every single property in the county. 220000+ properties. I am doing this because of the wild increase in property taxes where I live. My taxes went from 3200 a year to 5000 a year. On average there has been a 40% increase for all properties. I use that term “all” very loosely because I have found that properties that are worth 2 million+ have very small increases, like 5% at most. A large percentage of those properties have actually gone down!!!.. There is some really crooked stuff going on there. The county just released the mill rates for the next tax bill that is due and boy OH boy are some people going to be really mad. We have a thing called TABOR where I live. That is a Taxpayers bill of rights. It caps the spending that the county is able to do to 5% more than the year before. If they collect too much money for the amount they spend they have to refund it. The reason why people are going to get really mad is because right now the county has not adjusted the mill rates to bring down the amount they are collecting. So they are going to be collecting 35% more than they are going to be able to use. They are going to sit on that money for a full year. When they refund the money what they do is take the total amount and divide it by the number of residents and everyone that lives in the county gets a check. The issue there is a large portion of the people that live in the county never paid property taxes because they do not own a home. They are taking my money and giving it to someone else without my express permission. Where I am from that is called theft. Once I have all of the property and tax data I am going to calculate the amount they are collecting and I will see if the number they have listed in the budget for the year for the amount of property tax collected. The numbers better be close. I already know they aren’t going to be but I want to have the data in hand.

Then I am going to go and find an attorney and sue the county for fraud.

So, events no longer with in the micropython bnding. We have a purpose. Otherwise, in this form, it can’t be used normally.

We go forward.
GitHub - kdschlosser/lvgl_micropython: LVGL module for MicroPython for firmware
GitHub - bdbarnett/mpdisplay: Display, touch and encoder drivers for MicroPython and lv_bindings_micropython for displaydriver

import lv_config
import lvgl as lv
import asyncio
from asyncio import sleep, create_task, Loop

scr = lv.screen_active()


async def btn_reset_task(obj=None, event=-1):

    print(f"Resetting... Taks rom: {obj}, event: {event}")
    scr.clean()

    rst_spinner = lv.spinner(scr)
    rst_spinner.set_size(100, 100)
    rst_spinner.center()
    rst_spinner.set_anim_params(10000, 60)

    rst_label = lv.label(scr)
    rst_label.center()
    rst_label.set_text("Progress...")

    print("Resetting...")
    await asyncio.sleep(5)
    print("Resetting... Done")

    # import machine
    # machine.reset()

    scr.clean()
    btn_reset_gen()


def btn_reset_gen():
    btn_reset = lv.button(scr)
    btn_reset.align(lv.ALIGN.TOP_MID, 0, 280)
    btn_reset.add_event_cb(lambda e: create_task(btn_reset_task()), lv.EVENT.CLICKED, None)
    label_reset = lv.label(btn_reset)
    label_reset.set_text('Reset Task')

    btn_reset = lv.button(scr)
    btn_reset.align(lv.ALIGN.TOP_MID, 0, 0)
    btn_reset.add_event_cb(lambda e: print("Resetting..."), lv.EVENT.CLICKED, None)
    label_reset = lv.label(btn_reset)
    label_reset.set_text('Reset Print')


btn_reset_gen()

asyncio.Loop.run_forever()

pythonSPI, ili9341.py+xpt2046.py from mpdisplay. MicroPython v1.23.0-preview + LVGL9.0
Some test.
touch test
asyncio - animation

Test Event.
“Test Results: get_current_target_obj is functioning properly. Sliding the slider works without any hanging issues, and the label accurately reflects percentage changes.”

    def slider_event_cb(self, event):

        ev = lv.event_t(event)
        obj = ev.get_current_target_obj()
        print(f"slider_event_cb: {obj} {obj.get_value()} {ev.get_code()}")
        self.slider_label.set_text(f"{obj.get_value()}%")


    def lv_example_slider_1(self):

        style_bar = lv.style_t()
        style_bar.init()
        style_bar.set_bg_color(lv.color_hex(0x00FF00))  # Green color
        style_bar.set_bg_grad_color(lv.color_hex(0x808080))  # Gray color
        style_bar.set_radius(lv.RADIUS_CIRCLE)
        style_bar.set_border_color(lv.color_hex(0xFFFFFF))  # White color
        style_bar.set_bg_opa(lv.OPA._90)

        self.slider = lv.slider(lv.screen_active())
        self.slider.add_style(style_bar, 20)
        self.slider.set_size(15, 240 - 50)
        self.slider.align(lv.ALIGN.LEFT_MID, 10, 0)

        self.slider.set_range(16, 28)

        self.slider.add_event_cb(self.slider_event_cb, lv.EVENT.VALUE_CHANGED, None)

        # Create a label below the slider
        self.slider_label = lv.label(lv.screen_active())
        self.slider_label.set_text("0%")
        self.slider_label.align_to(self.slider, lv.ALIGN.OUT_LEFT_MID, 50, 0)