Start a new topic

Circular gauge - Start degree

It would be nice if the 0 degrees was "downwards" instead of "left". 

Then it would be much easier to create circular gauges, where most are below 90 degrees left. Now you need some fancy mathematics to solve it


4 people like this idea

I am now reviewing all of the Feature Requests, this will take some time, patience please.

- there are other posts requesting several variations of start.

- wherever it starts, it is wrong for all the other applications of it.

As it was requested previously, carried forward


1 person likes this
Since a fixed starting position will never be right for everyone, how about making it programmable?

Anther enhancement that would be great is when the pointer is drawn, instead of having the line always begin in the middle of the gauge, have it begin at a programmable radius from the middle.  Most mechanical gauges have a small disc in the center to cover the needle pivot, and having the Nextion gauge needle start at a radius > 0 would help in creating that appearance.

 

Just posted a similar request (didn't see that)

to move the starting point, try map function


Example with 0 at 310deg angle for the gauge

Temperature reading 0 to 300c (300c @220deg angle)


   int zgpucm = (temps[1]);

    zgpucm = map(zgpucm, 0, 300, 0, 270);

    if (zgpucm >= 0 && zgpucm < 50){

      int zgpucm1 = zgpucm;

      zgpucm1 = map(zgpucm1, 0, 50, 310 , 360);

      zgpuc.setValue(zgpucm1);

    }else{

      int zgpucm2 = zgpucm;

      zgpucm2 = map(zgpucm2, 50 , 270, 0, 220);

      zgpuc.setValue(zgpucm2);

      }  

Can this be solved with a circle overlapping the pointer?

Here is my solution to the problem. I jused a timer to redefine the value for the gauge. You can modify to any startingpoint.

HMI
(14.6 KB)

Oh, what kind of "fancy" math is needed - simple ratios with an if clause. Here will be the problem.  When you realize that there is 8K of SRAM driving the basic series of Nextion display, and 3584 bytes of that is dedicated to your HMI designed page, you begin to realize that there is not as much remaining in the firmware.  So when functions that require the simple task of programming a function on the connecting MCU, or in the component event code for that matter, It will be much easier for the calculation to be done by the user as needed then clogging the firmware with libraries that not everyone will need (they won't need it because they have written a simple function).


So I will say that I for one am against such a motion to increase the firmware with more unnecessary custom attributes that further steals even more space away from the HMI design space. Maoartland has provided a fair alternative solution.

Login or Signup to post a comment