From 2013d9d1d93092868b8c3fdcaa3ec0da4c22032d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Lino?= Date: Wed, 12 Aug 2015 10:04:00 +0100 Subject: [PATCH] added a template to print the contents of variables, in debug mode. --- brew.ino | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/brew.ino b/brew.ino index 5db1e2e..32b7602 100644 --- a/brew.ino +++ b/brew.ino @@ -82,6 +82,17 @@ // ++++++++++++++++++++++++ ENUM +++++++++++++++++++++++++++++++++ #include "CustomDataStructures.h" +// ######################### TEMPLATES ######################### +// ++++++++++++++++++++++++ Debug ++++++++++++++++++++++++ +template void debugPrintVar( char *name, const T& value ); +template void debugPrintVar( char *name, const T& value ) { + Serial.print("["); + Serial.print(name); + Serial.print(":"); + Serial.print(value); + Serial.println("]"); +} + // ######################### VARIABLES ######################### // ++++++++++++++++++++++++ State Machine ++++++++++++++++++++++++ eRotaryEncoderMode rotaryEncoderMode; @@ -885,6 +896,12 @@ void xCountTheTime( int temperatureRange ) { // Check if the machine is in the right temperature range, for the current mode, if(!(basePT100.getCurrentTemperature() > (cookTemperature - temperatureRange) && basePT100.getCurrentTemperature() < (cookTemperature + temperatureRange))) { clockIgnore += millis() - clockStartTime - clockCounter; +#ifdef DEBUG + Serial.print("[clockIgnore:"); + Serial.print(clockIgnore); + Serial.println("]"); + debugPrintVar("clockIgnore", clockIgnore); +#endif } // Calculate the remaining time on the clock @@ -1354,3 +1371,4 @@ void lcdPrint(String title, String message) { } } + -- 2.24.1