Navigation

    M5Stack Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    1. Home
    2. margel
    M
    • Continue chat with margel
    • Start new chat with margel
    • Flag Profile
    • Profile
    • Following
    • Followers
    • Blocks
    • Topics
    • Posts
    • Best
    • Groups
    Save
    Saving

    margel

    @margel

    0
    Reputation
    2
    Posts
    70
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    margel Follow

    Posts made by margel

    • RE: old text line visible under new one

      I think I have already tried that. Then I have the "problem" that the screen seems to flicker. So all text disappears for half a second and then the image is rebuilt. This is very "unpleasant" to watch.

      posted in Micropython
      M
      margel
    • old text line visible under new one

      Hi!

      Please excuse the title, which probably does not give much. But I did not know how to describe my problem differently...

      I have with some help put together a script that displays data from my inverter. Depending on whether energy is being fed into the grid or drawn from the grid, the line of text changes. The text for drawing is shorter than the text for feeding. Now you can see "remnants" of the overshifted line.

      I upload a screenshot, a picture is worth 1000 words.
      0_1678547183541_2023-03-11_15h58_52.png
      The problem also affects the other lines if the new values are smaller than the previous ones.

      The code I use:

      # Endlosschleife zum Anzeigen der Leistungsdaten
      lcd.clear(lcd.BLACK)
      while True:
          # Leistungsdaten abrufen
          data = get_fronius_data(FRONIUS_IP)
          
          # Neue Leistungsdaten speichern
          pv_leistung = data["Site"]["P_PV"]
          verbrauch = data["Site"]["P_Load"]
          p_grid = data["Site"]["P_Grid"]
      
          # Nur die aktualisierten Werte auf dem Bildschirm anzeigen
          lcd.print("PV Leistung: {:.2f} kW".format(pv_leistung/1000), lcd.CENTER, 50, lcd.WHITE)
          lcd.print("Verbrauch: {:.2f} kW".format(verbrauch/1000), lcd.CENTER, 100, lcd.WHITE)
          
          # Textfarbe basierend auf dem Vorzeichen von p_grid setzen
          if p_grid < 0:
              lcd.print("Einspeisung: {:.2f} kW".format(-p_grid/1000), lcd.CENTER, 150, lcd.GREEN)
          else:
              lcd.print("Bezug: {:.2f} kW".format(p_grid/1000), lcd.CENTER, 150, lcd.RED)
          
          # Kurze Pause einlegen
          utime.sleep(2)
      

      How can I change this so that this problem does not occur?

      thx!

      posted in Micropython
      M
      margel