From 8d68cee028c7f2912aa5998cfda981f5a3ac3d48 Mon Sep 17 00:00:00 2001 From: Carl Philipp Klemm <philipp@uvos.xyz> Date: Fri, 3 Nov 2023 13:25:38 +0100 Subject: [PATCH] reset bus when trying to reenable a heater --- heater.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/heater.cpp b/heater.cpp index ff97ffb..5d5c272 100644 --- a/heater.cpp +++ b/heater.cpp @@ -70,6 +70,12 @@ void Heaters::recoverDevice(int device) devices[device].mutex->lock(); coincellhell_disconnect(&devices[device].device); int ret = coincellhell_connect(&devices[device].device, devices[device].serial); + if(ret == 0) + { + coincellhell_reset_bus(&devices[device].device); + coincellhell_disconnect(&devices[device].device); + ret = coincellhell_connect(&devices[device].device, devices[device].serial); + } devices[device].mutex->unlock(); if(ret == 0) -- GitLab