修复启动klipper时获取不到最小版本的问题
This commit is contained in:
parent
338dbfbe18
commit
0a18e41612
@ -84,30 +84,29 @@ class FirmwareUpdate:
|
|||||||
logging.exception(f"Failed to enable power button during error recovery: {power_err}")
|
logging.exception(f"Failed to enable power button during error recovery: {power_err}")
|
||||||
|
|
||||||
async def build_mcu_info(self) -> None:
|
async def build_mcu_info(self) -> None:
|
||||||
retries = 5
|
retries = 0
|
||||||
printer_info: Dict[str, Any] = {}
|
printer_info: Dict[str, Any] = {}
|
||||||
cfg_status: Dict[str, Any] = {}
|
cfg_status: Dict[str, Any] = {}
|
||||||
while retries:
|
while retries < 5:
|
||||||
try:
|
printer_info = await self.klippy_apis.get_klippy_info()
|
||||||
printer_info = await self.klippy_apis.get_klippy_info()
|
klipper_sta = printer_info.get("state", "")
|
||||||
cfg_status = await self.klippy_apis.query_objects({'configfile': None})
|
if klipper_sta != "startup":
|
||||||
except self.server.error:
|
try:
|
||||||
logging.exception("PanelDue initialization request failed")
|
cfg_status = await self.klippy_apis.query_objects({'configfile': None})
|
||||||
retries -= 1
|
config = cfg_status.get('configfile', {}).get('config', {})
|
||||||
if not retries:
|
self.klipper_version = printer_info.get("software_version", "").split('-')[0]
|
||||||
raise
|
self._build_basic_mcu_info(config)
|
||||||
|
await self._update_mcu_versions()
|
||||||
|
self._check_mcu_update_needed()
|
||||||
|
logging.info("MCU versions updated successfully.")
|
||||||
|
break
|
||||||
|
except Exception as e:
|
||||||
|
retries += 1
|
||||||
|
await asyncio.sleep(1.)
|
||||||
|
else:
|
||||||
|
logging.info("Klipper is in startup state. Waiting...")
|
||||||
|
retries += 1
|
||||||
await asyncio.sleep(1.)
|
await asyncio.sleep(1.)
|
||||||
continue
|
|
||||||
break
|
|
||||||
config = cfg_status.get('configfile', {}).get('config', {})
|
|
||||||
self.klipper_version = printer_info.get("software_version", "").split('-')[0]
|
|
||||||
try:
|
|
||||||
self._build_basic_mcu_info(config)
|
|
||||||
await self._update_mcu_versions()
|
|
||||||
self._check_mcu_update_needed()
|
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
logging.exception(f"An error occurred while building MCU info: {e}")
|
|
||||||
|
|
||||||
def _build_basic_mcu_info(self, config: Dict[str, Any]) -> None:
|
def _build_basic_mcu_info(self, config: Dict[str, Any]) -> None:
|
||||||
for mcu, value in config.items():
|
for mcu, value in config.items():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user