Troubleshooting Communication Problems with the Pi Hat
We have noticed that in some occasions, specially with the Raspberry Pi 4 being powered from the Pi Hat, it is possible that due to current fluctuations, the Pi Hat loses power and stops responding to the Payment master daemon. For that reason, it has been decided to add a feature that could log these issues to the logfile, and also allow NodeRED users to see if this issue occurred.
It is important to note that this information is disclaimed by Qibixx, stating that its Power Supply capabilities can deliver up to 3A, which is enough for most of the Pi Models, but may be on the fringe for Raspberry Pi 4.
To enable this functionality, it is first necessary to enable the watchdog feature on Payment Master Daemon by editing the startup.sh script and adding "device-watchdog=true".
echo "STARTING UP..." > start.log
## Arguments for cashless master daemon, you can use multiple ones separating them with space inbetween...
ARGS="debug=true device-watchdog=true"
## Start the daemon
nohup lua paymentMasterDaemon.lua $ARGS >log.txt 2>error.txt&
Now, in case there is an issue with the communication, the errors will be shown in the log file (if "debug=true").
[ERROR 10:42:02] |CashlessMaster| paymentMasterDaemon.lua:381: [Watchdog] Serial connection not responding...
[ERROR 10:42:02] |CashlessMaster| paymentMasterDaemon.lua:229: Pi hat/USB-MDB failed to respond! Retry in 10 seconds
** **
Catching the error in NodeRED
In case there is also the need to log the issue on NodeRED, it is necessary to take the following steps:
1 - Add a debug output to Payment Master Daemon, needs to be on the bottom output (label msg on picture below)

2 - Change the configuration of this debug output to "Complete msg object".
** **

3 - Click done and reload deploy the flow. Now, when the issue occurs, the debug console will show an error like displayed below.
