From 2e7765f468c46728df16faa903d1f4b8a17f76fd Mon Sep 17 00:00:00 2001
From: Guo Wenxue <guowenxue@gmail.com>
Date: Wed, 21 Sep 2022 23:09:27 +0800
Subject: [PATCH] update sqlite_blob.c
---
mqttd/hal/ds18b20.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/mqttd/hal/ds18b20.c b/mqttd/hal/ds18b20.c
index 2aa9116..cf9daf8 100644
--- a/mqttd/hal/ds18b20.c
+++ b/mqttd/hal/ds18b20.c
@@ -20,6 +20,8 @@
#include <time.h>
#include <errno.h>
+#include "lylib/logger.h"
+
/* File Content:
pi@raspberrypi:~/guowenxue $ cat /sys/bus/w1/devices/28-041731f7c0ff/w1_slave
3a 01 4b 46 7f ff 0c 10 a5 : crc=a5 YES
@@ -48,7 +50,7 @@
*+-------------------------------------------------------------------+*/
if((dirp = opendir(w1_path)) == NULL)
{
- printf("opendir error: %s\n", strerror(errno));
+ log_err("opendir '%s' error: %s\n", w1_path, strerror(errno));
return -2;
}
@@ -66,7 +68,7 @@
if( !found )
{
- printf("Can not find ds18b20 in %s\n", w1_path);
+ log_fatal("Can not find ds18b20 in %s\n", w1_path);
return -3;
}
@@ -77,20 +79,20 @@
/* open file /sys/bus/w1/devices/28-xxxx/w1_slave to get temperature */
if( (fd=open(w1_path, O_RDONLY)) < 0 )
{
- printf("open %s error: %s\n", w1_path, strerror(errno));
+ log_err("open %s error: %s\n", w1_path, strerror(errno));
return -4;
}
if(read(fd, buf, sizeof(buf)) < 0)
{
- printf("read %s error: %s\n", w1_path, strerror(errno));
+ log_err("read %s error: %s\n", w1_path, strerror(errno));
return -5;
}
ptr = strstr(buf, "t=");
if( !ptr )
{
- printf("ERROR: Can not get temperature\n");
+ log_err("ERROR: Can not get temperature\n");
return -6;
}
--
Gitblit v1.9.1