From 19df75712b88cbdc21b59f3514353ff83fef496d Mon Sep 17 00:00:00 2001 From: sdrapha <25059996+sdrapha@users.noreply.github.com> Date: Tue, 9 Dec 2025 09:01:17 -0500 Subject: [PATCH 1/2] update dockerhub refs --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 54b80fd..1229d74 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,7 +58,7 @@ jobs: platforms: linux/amd64,linux/arm64 pull: true push: true - cache-from: type=registry,ref=nohn/watermeter:latest + cache-from: type=registry,ref=riulopkat/watermeter:latest cache-to: type=inline tags: riulopkat/watermeter:latest labels: ${{ steps.meta.outputs.labels }} @@ -70,7 +70,7 @@ jobs: platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 pull: true push: true - cache-from: type=registry,ref=nohn/watermeter:develop + cache-from: type=registry,ref=riulopkat/watermeter:develop cache-to: type=inline tags: riulopkat/watermeter:develop labels: ${{ steps.meta.outputs.labels }} From b95613ff134e0f43bd29203aa5e394203fb833b6 Mon Sep 17 00:00:00 2001 From: sdrapha <25059996+sdrapha@users.noreply.github.com> Date: Tue, 9 Dec 2025 08:58:06 -0500 Subject: [PATCH 2/2] More fixes to keep the proper trailing zeroes on postdecimal numbers. improvements to debug page readability --- classes/Reader.php | 32 +++++++++++++++++++++----------- public/index.php | 25 +++++++++++++++++++++---- 2 files changed, 42 insertions(+), 15 deletions(-) diff --git a/classes/Reader.php b/classes/Reader.php index d218241..5c5b4c3 100644 --- a/classes/Reader.php +++ b/classes/Reader.php @@ -127,30 +127,40 @@ private function readDigits($post_decimal = false) // $numberDigital = '00815'; if ($this->debug) { $numberDigitalImage->writeImage('tmp/' . $cachePrefix . '_digital.jpg'); + echo "Debug output from Reader.php readDigits()"; + echo '
'; + if ($post_decimal == true) { echo 'Post decimal:
'; } echo "Raw OCR: $numberOCR
"; - echo "Clean OCR: $numberDigital"; + echo "Clean OCR: $numberDigital
"; echo 'Digital Preview
'; + echo '

'; } if (is_numeric($numberDigital)) { - $numberRead = (int)$numberDigital; + $numberRead = (string)$numberDigital; } else { # FIXXME - $numberRead = (int)$this->lastValue; + $numberRead = (string)$this->lastValue; if ($this->debug) { echo 'Choosing last value ' . $numberRead . '
'; } $this->errors['readDigits() : !is_numeric()'] = 'Could not interpret "' . $numberDigital . '". Using last known value ' . (int)$this->lastValue; $this->hasErrors = true; } - if ($this->debug) { - echo "Digital: $numberRead
"; - echo ''; - echo ''; - } + // Redundant, comment out temporarily: + // if ($this->debug) { + // echo '
'; - $digitalSourceImage->writeImage('tmp/input.jpg'); - $numberDigitalImage->writeImage('tmp/' . $cachePrefix . '_digital.png'); - echo '
'; + // echo '
'; + // echo "ReadDigits method:
"; + // echo "Digital: $numberRead
"; + // echo 'digital source image
'; + // $digitalSourceImage->writeImage('tmp/input.jpg'); + // echo ''; + // echo '
number digital image
'; + // $numberDigitalImage->writeImage('tmp/' . $cachePrefix . '_digital.png'); + // echo ''; + // echo '
'; + // } return $numberRead; } diff --git a/public/index.php b/public/index.php index 4f675d1..e4ec129 100644 --- a/public/index.php +++ b/public/index.php @@ -35,6 +35,7 @@ if (isset($_GET['debug'])) { $debug = true; + echo ''; } else { $debug = false; } @@ -51,7 +52,6 @@ $readout = $watermeterReader->getReadout(); $offset = $watermeterReader->getOffset(); $value = $readout+$offset; - $returnData = array(); if ($watermeterReader->hasErrors()) { $returnData['readout'] = $lastValue; @@ -72,17 +72,34 @@ file_put_contents(__DIR__ . '/../src/config/lastValue.txt', $readout); } if ($debug) { - echo ''; + echo "

"; + echo "
------ Begin Debug output from index.php------
"; + echo "
Status: "; + echo $returnData['status'] . "
"; + echo "
Input image:
"; + echo ''; - echo '
'; $watermeterReader->writeDebugImage(__DIR__ . '/../public/tmp/input_debug.jpg'); echo ''; - echo '
'; + echo ''; + + echo "
"; echo "hasErrors: " . $watermeterReader->hasErrors() . "\n
"; + echo "
"; + echo "getErrors result:"; + echo "
"; + echo "-----------------------------
"; + echo '
'; echo "
";
         var_dump($watermeterReader->getErrors());
         echo "
"; + echo "
"; + echo "-----------------------------
"; + echo "
"; + echo "lastValueChanged: $lastValueTimestamp\n
"; echo "lastValue: $lastValue\n
"; + echo "readout: $readout\n
"; echo "value: $value\n
"; + echo "
-----end of debug output-----

"; } if (isset($_GET['json'])) { header("Content-Type: application/json");