Skip to content

Adding a radial gauge to the library - #6

Open
davidgs wants to merge 5 commits into
kublet:masterfrom
davidgs:gauges
Open

Adding a radial gauge to the library#6
davidgs wants to merge 5 commits into
kublet:masterfrom
davidgs:gauges

Conversation

@davidgs

@davidgs davidgs commented Aug 7, 2024

Copy link
Copy Markdown
Contributor

A radial gauge (with or without hash-marks) for the display

@audreylim audreylim left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the APIs. Can you provide some images on how it looks like, as well as code snippets on how it might be used?

Comment thread kgfx.cpp
Comment thread kgfx.cpp
Comment thread kgfx.cpp
@davidgs

davidgs commented Aug 8, 2024

Copy link
Copy Markdown
Contributor Author

Screenshot:
IMG_2106

I'm currently using it with the InfluxDB app I wrote:

  while (result.next()) {
      // Get the value of the "_value" column
      FluxValue value = result.getValueByName("_value");
      double a = value.getDouble();
      int color = TFT_WHITE;
      if (a <= STAT_LOWER) {
        color = TFT_BLUE;
      } else if (a > STAT_LOWER && a <= STAT_MID) {
        color = TFT_GREEN;
      } else if (a > STAT_MID && a <= STAT_UPPER) {
        color = TFT_YELLOW;
      } else {
        color = TFT_RED;
      }
      ui.drawGauge(STAT_LABEL.c_str(), SUFFIX.c_str(), a, 50, 0, TFT_WHITE, color, true);
    } 

@audreylim audreylim left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think your editor's formatting may make the code more readable, so let's leave it.

The gauge looks great and the code LGTM. Just a minor fix and we can merge this.

We'll probably add an examples folder to this repo in future.

@davidgs

davidgs commented Aug 15, 2024

Copy link
Copy Markdown
Contributor Author

Are we ok to merge this?

@audreylim

Copy link
Copy Markdown
Contributor

One more thing, it works well but only for static data. Is this meant to be constantly refreshing? We would need to draw it on a large sprite if so.

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.

2 participants