Skip to content

Commit 1706ad2

Browse files
Fix WebUI Estimations (Recalculations and TBD)
Previously changing the postpone period in the WebUi did not correctly recalculate the new estimate flash time. Now we force it too. As well previously the estimate did not reset to (TBD) when disabling update checks.
1 parent 5c141f5 commit 1706ad2

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

MerlinAU.sh

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# Original Creation Date: 2023-Oct-01 by @ExtremeFiretop.
66
# Official Co-Author: @Martinski W. - Date: 2023-Nov-01
7-
# Last Modified: 2025-May-19
7+
# Last Modified: 2025-May-21
88
###################################################################
99
set -u
1010

@@ -2559,7 +2559,7 @@ _WebUI_SetEmailConfigFileFromAMTM_()
25592559
}
25602560

25612561
##---------------------------------------##
2562-
## Added by ExtremeFiretop [2025-May-20] ##
2562+
## Added by ExtremeFiretop [2025-May-21] ##
25632563
##---------------------------------------##
25642564
_ActionsAfterNewConfigSettings_()
25652565
{
@@ -2584,7 +2584,7 @@ _ActionsAfterNewConfigSettings_()
25842584
fi
25852585
if _ConfigOptionChanged_ "FW_New_Update_Postponement_Days="
25862586
then
2587-
_Calculate_NextRunTime_
2587+
_Calculate_NextRunTime_ recal
25882588
fi
25892589
if _ConfigOptionChanged_ "Allow_Script_Auto_Update"
25902590
then
@@ -5945,13 +5945,18 @@ _Calculate_DST_()
59455945
}
59465946

59475947
##------------------------------------------##
5948-
## Modified by ExtremeFiretop [2024-Jun-10] ##
5948+
## Modified by ExtremeFiretop [2025-May-21] ##
59495949
##------------------------------------------##
59505950
_Calculate_NextRunTime_()
59515951
{
5952+
local force_recalc=false
59525953
local fwNewUpdateVersion fwNewUpdateNotificationDate
59535954
local upfwDateTimeSecs nextCronTimeSecs
59545955

5956+
if [ "$1" = "recal" ]
5957+
then force_recalc=true
5958+
fi
5959+
59555960
# Check for available firmware update
59565961
if ! fwNewUpdateVersion="$(_GetLatestFWUpdateVersionFromRouter_ 1)"; then
59575962
fwNewUpdateVersion="NONE FOUND"
@@ -5966,7 +5971,7 @@ _Calculate_NextRunTime_()
59665971
elif [ "$fwNewUpdateVersion" = "NONE FOUND" ]
59675972
then
59685973
ExpectedFWUpdateRuntime="${REDct}NONE FOUND${NOct}"
5969-
elif [ "$ExpectedFWUpdateRuntime" = "TBD" ] || [ -z "$ExpectedFWUpdateRuntime" ]
5974+
elif [ "$force_recalc" = "true" ] || [ "$ExpectedFWUpdateRuntime" = "TBD" ] || [ -z "$ExpectedFWUpdateRuntime" ]
59705975
then
59715976
# If conditions are met (cron job enabled and update available), calculate the next runtime
59725977
fwNewUpdateNotificationDate="$(Get_Custom_Setting FW_New_Update_Notification_Date)"
@@ -6196,7 +6201,7 @@ _Set_FW_UpdatePostponementDays_()
61966201
then
61976202
Update_Custom_Settings FW_New_Update_Postponement_Days "$newPostponementDays"
61986203
echo "The number of days to postpone F/W Update was updated successfully."
6199-
_Calculate_NextRunTime_
6204+
_Calculate_NextRunTime_ recal
62006205
_WaitForEnterKey_ "$mainMenuReturnPromptStr"
62016206
fi
62026207
return 0
@@ -6668,7 +6673,7 @@ _Set_FW_UpdateCronScheduleCustom_()
66686673
printf "Cron job '${GRNct}${CRON_JOB_TAG}${NOct}' was updated successfully.\n"
66696674
current_schedule_english="$(translate_schedule "$nextCronSchedule")"
66706675
printf "Job Schedule: ${GRNct}${current_schedule_english}${NOct}\n"
6671-
_Calculate_NextRunTime_
6676+
_Calculate_NextRunTime_ recal
66726677
else
66736678
retCode=1
66746679
printf "${REDct}**ERROR**${NOct}: Failed to add/update the cron job [${CRON_JOB_TAG}].\n"
@@ -7073,7 +7078,7 @@ _Set_FW_UpdateCronScheduleGuided_()
70737078
printf "Cron job '${GRNct}${CRON_JOB_TAG}${NOct}' was updated successfully.\n"
70747079
cronSchedStrHR="$(_TranslateCronSchedHR_ "$nextCronSched")"
70757080
printf "Job Schedule: ${GRNct}${cronSchedStrHR}${NOct}\n"
7076-
_Calculate_NextRunTime_
7081+
_Calculate_NextRunTime_ recal
70777082
else
70787083
retCode=1
70797084
printf "${REDct}**ERROR**${NOct}: Failed to add/update the cron job [${CRON_JOB_TAG}].\n"
@@ -9811,9 +9816,9 @@ _DisableFWAutoUpdateChecks_()
98119816
fi
98129817
}
98139818

9814-
##-------------------------------------##
9815-
## Added by Martinski W. [2025-Jan-05] ##
9816-
##-------------------------------------##
9819+
##---------------------------------------##
9820+
## Added by ExtremeFiretop [2025-May-21] ##
9821+
##---------------------------------------##
98179822
_EnableFWAutoUpdateChecks_()
98189823
{
98199824
_AddFWAutoUpdateHook_
@@ -9826,6 +9831,7 @@ _EnableFWAutoUpdateChecks_()
98269831
nvram set firmware_check_enable="$FW_UpdateCheckState"
98279832
nvram commit
98289833
fi
9834+
_Calculate_NextRunTime_
98299835
}
98309836

98319837
##----------------------------------------##

0 commit comments

Comments
 (0)