Amended update method to entire rounds

A single larger delay is now inserted once between entire rounds of status updates,
This commit is contained in:
Philip Abbey
2024-03-21 09:15:47 +00:00
parent 00b071c132
commit a0fe746c1d
5 changed files with 10 additions and 17 deletions

View File

@ -261,7 +261,7 @@ class HomeAssistantApp extends Application.AppBase {
// Start the continuous update process that continues for as long as the application is running.
// The chain of functions from 'updateNextMenuItem()' calls 'updateNextMenuItem()' on completion.
if (mItemsToUpdate.size() > 0) {
updateNextMenuItem();
updateNextMenuItemInt();
}
}
@ -396,7 +396,7 @@ class HomeAssistantApp extends Application.AppBase {
function updateNextMenuItem() as Void {
var delay = Settings.getPollDelay();
if (delay >= 50) { // Minimum 50 ms delay for Timers
if ((delay > 0) and (mNextItemToUpdate == 0)) {
mUpdateTimer.start(method(:updateNextMenuItemInt), delay, false);
} else {
updateNextMenuItemInt();

View File

@ -63,12 +63,6 @@ class Settings {
mIsBatteryLevelEnabled = Properties.getValue("enable_battery_level");
mBatteryRefreshRate = Properties.getValue("battery_level_refresh_rate");
// There's a minimum of 50 ms on Timer.Timers, so reset to 0 if too small.
if (mPollDelay < 50) { // milliseconds
mPollDelay = 0;
Properties.setValue("poll_delay", mPollDelay);
}
if (System has :ServiceDelegate) {
mHasService = true;
}
@ -147,7 +141,7 @@ class Settings {
}
static function getPollDelay() as Lang.Number {
return mPollDelay;
return mPollDelay * 1000; // Convert to milliseconds
}
static function getConfirmTimeout() as Lang.Number {