From 6f7f97c26fd290885dfeb1b7603907458cd9302e Mon Sep 17 00:00:00 2001 From: Stefan Brand Date: Sun, 23 May 2021 11:00:16 +0200 Subject: [PATCH] Add More Debug Output for HM330x --- lib/HM330x/HM330x.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/HM330x/HM330x.cpp b/lib/HM330x/HM330x.cpp index 7e6e0ef..af6364c 100644 --- a/lib/HM330x/HM330x.cpp +++ b/lib/HM330x/HM330x.cpp @@ -39,10 +39,12 @@ void HM330x::initialize(void) { DEBUG_PRINTLN("HM330x::initialize"); // Send select command while (!sendCmd(HM330x_SELECT)) { - if (retryCount++ >= 0) { + if (retryCount++ >= 10) { + DEBUG_PRINTLN("HM330x::initialize Select Failed!"); return; } else { - delay(100); + delay(500); + DEBUG_PRINTLN("HM330x::initialize Retrying Select..."); } } } @@ -61,8 +63,13 @@ uint8_t HM330x::getSensorData(char *payload, uint8_t startbyte) { // Get Data from the Sensors Wire.requestFrom(HM330x_ADDR, HM330x_DATA_LEN); if (Wire.available()) { - for (uint8_t i = 0; i