Updating a display is normally "noisy". I have a voltage display which, while important, doesn't change much very often, so in loop() I will have something like:
int oldVoltage, voltage;????????????????????????????? // These are globals and both set in setup()
void loop() {
?? // a bunch of code...
?? voltage = ReadVoltage();????????????????????????? // Does an analog read via a voltage divider and mapped
?? if ( abs(voltage - oldVoltage) / 100.0 > .2) {??? // check for a 2/10V drop...
??????? VoltageWarning(voltage);
??????? oldVoltage = voltage;
?? }
}
This kind of code would check for a .2V change. I keep voltage as an int, and then scale it for display with one decimal place. This would avoid updating the screen 15,000 times a second, which will introduce flicker on the display. Also, the warning function only updates a field, not the entire display. The actual code will likely change when I'm done, but you get the idea...
From: Sean W7SKD <sean.jrdalys@...> To:[email protected] Sent: Thursday, January 18, 2018 12:08 PM Subject: Re: [BITX20] S-Meter code help... #ubitx-help
Well...the issue is that the ubitx arduino program (and the bitx40 programs for that matter), were written with the expectation that you would only need to update the display if you changed frequency or went into the menus.? That made sense, because those programs only NEEDED to change what was displayed if there was a frequency change (or menu selection, as in the ubitx version).
Look in the 'loop' function in the ubitx code? - you might consider hacking in a function call to the display function you are using for your meter.? I haven't tried it, but it MAY increase noise as the display would then get updated constantly.? If that solves your problem, a more advanced approach would be to code in some logic that only updates the meter every fifth or tenth or twentieth (you get the idea) time through the loop, as it likely doesnt make sense to do it EVERY time through.