feat(notification): add TMC overheating warnings (#1919)

This commit is contained in:
Stefan Dej 2024-07-06 21:46:04 +02:00 committed by GitHub
parent 6fd32511dc
commit 81ea9cdaaf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 46 additions and 1 deletions

View File

@ -35,7 +35,11 @@
"OneHourShort": "1H",
"OneWeekShort": "1W",
"Remind": "Remind:",
"ShowDetails": "show details"
"ShowDetails": "show details",
"TmcOtFlag": "Stepper driver error: OT flag set",
"TmcOtFlagText": "The stepper driver '{name}' has triggered the OT flag and stopped working. This can be caused by a too high current. Please check the stepper driver settings and cooling.",
"TmcOtpwFlag": "Stepper driver warning: OTPW flag set",
"TmcOtpwFlagText": "The stepper driver '{name}' has triggered the OTPW flag and may stop working if it gets any hotter. This is an indication of an over temperature condition. This can be caused by a too high current. Please check the stepper driver settings and cooling."
},
"NumberInput": {
"GreaterOrEqualError": "Must be greater or equal than {min}!",

View File

@ -41,6 +41,9 @@ export const getters: GetterTree<GuiNotificationState, any> = {
// browser warnings
notifications = notifications.concat(getters['getNotificationsBrowserWarnings'])
// TMC overheat warnings
notifications = notifications.concat(getters['getNotificationsOverheatDrivers'])
const mapType = {
normal: 2,
high: 1,
@ -398,6 +401,44 @@ export const getters: GetterTree<GuiNotificationState, any> = {
return notifications
},
getNotificationsOverheatDrivers: (state, getters, rootState) => {
const notifications: GuiNotificationStateEntry[] = []
const date = rootState.server.system_boot_at ?? new Date()
Object.keys(rootState.printer)
.filter((key) => key.startsWith('tmc'))
.forEach((key) => {
const printerObject = rootState.printer[key]
const name = key.split(' ')[1]
if ((printerObject.drv_status?.ot ?? null) === 1) {
notifications.push({
id: `tmcwarning/${key}-ot`,
priority: 'critical',
title: i18n.t('App.Notifications.TmcOtFlag').toString(),
description: i18n.t('App.Notifications.TmcOtFlagText', { name }).toString(),
date,
dismissed: false,
url: 'https://www.klipper3d.org/TMC_Drivers.html#tmc-reports-error-ot1overtemperror',
})
}
if ((printerObject.drv_status?.otpw ?? null) === 1) {
notifications.push({
id: `tmcwarning/${key}-otpw`,
priority: 'high',
title: i18n.t('App.Notifications.TmcOtpwFlag').toString(),
description: i18n.t('App.Notifications.TmcOtpwFlagText', { name }).toString(),
date,
dismissed: false,
url: 'https://www.klipper3d.org/TMC_Drivers.html#tmc-reports-error-ot1overtemperror',
})
}
})
return notifications
},
getDismiss: (state, getters, rootState) => {
const currentTime = new Date()
const systemBootAt = rootState.server.system_boot_at ?? new Date()