RaspberrPi project source code
guowenxue
yesterday f458c74a9e88d8b01791184caac5a494d1125bff
Update thingsboard default config
3 files modified
30 ■■■■■ changed files
project/modules/tsl2561.c 18 ●●●● patch | view | raw | blame | history
project/modules/tsl2561.h 3 ●●●● patch | view | raw | blame | history
project/thingsboard/etc/thingsboard.conf 9 ●●●●● patch | view | raw | blame | history
project/modules/tsl2561.c
@@ -10,7 +10,7 @@
 *      ChangeLog:  1, Release initial version on "10/08/23 17:52:00"
 *
 * Pin connection:
 *               STH20 Module            Raspberry Pi Board
 *              TSL2561 Module           Raspberry Pi Board
 *                   VCC      <----->      #Pin1(3.3V)
 *                   SDA0     <----->      #Pin27(SDA, BCM GPIO0)
 *                   SCL0     <----->      #Pin28(SCL, BCM GPIO1)
@@ -20,7 +20,6 @@
 *                  dtoverlay=i2c0,pins_0_1
 *
 ********************************************************************************/
#include <string.h>
#include <stdio.h>
@@ -146,7 +145,7 @@
int tsl2561_get_lux(float *lux)
{
    int                 i, fd;
    int                 rv = 0;
    int                 rv = 0;
    char               *dev = TSL2561_I2CDEV;
    float               div = 0.0;
@@ -155,11 +154,11 @@
    int                 chn0_data = 0;
    int                 chn1_data = 0;
    if( !lux )
    {
        log_error("Invalid input arguments\n");
        return -1;
    }
    if( !lux )
    {
        log_error("Invalid input arguments\n");
        return -1;
    }
    if( (fd=open(dev, O_RDWR)) < 0)
    {
@@ -182,7 +181,7 @@
    if( chn0_data<=0 || chn1_data<0 )
    {
        rv = -2;
        rv = -2;
        goto OUT;
    }
@@ -205,5 +204,6 @@
OUT:
    tsl2561_power(fd, OFF);
    close(fd);
    return rv;
}
project/modules/tsl2561.h
@@ -10,7 +10,7 @@
 *      ChangeLog:  1, Release initial version on "10/08/23 17:52:00"
 *
 * Pin connection:
 *               STH20 Module            Raspberry Pi Board
 *              TSL2561 Module           Raspberry Pi Board
 *                   VCC      <----->      #Pin1(3.3V)
 *                   SDA0     <----->      #Pin27(SDA, BCM GPIO0)
 *                   SCL0     <----->      #Pin28(SCL, BCM GPIO1)
@@ -20,7 +20,6 @@
 *                  dtoverlay=i2c0,pins_0_1
 *
 ********************************************************************************/
#ifndef  _TSL2561_H_
#define  _TSL2561_H_
project/thingsboard/etc/thingsboard.conf
@@ -1,5 +1,5 @@
[common]
devid="raspberrypi4b"
devid="RaspberryPi#4B"
# 树莓派连接的外设信息,0:禁用或未连接  其他: 使能或相关硬件连接的Pin管脚(wPI模式)
[hardware]
@@ -21,7 +21,6 @@
# 日志回滚大小
size=1024
[broker]
# broker 服务器地址和端口号
@@ -35,8 +34,6 @@
username="lingyun"
password="lingyun"
# broker给subsciber和publisher发送PING报文保持 keepalive 的时间周期,单位是秒
keepalive=30
@@ -46,12 +43,12 @@
[publisher]
# mosquitto_pub -h weike-iot.com -p 2262 -t v1/devices/me/telemetry -i "raspberrypi4b" -u "l3ie6juxf0t9wn8kjsk4" -m '{"temperature":28.55, "humidity":70.65}'
# mosquitto_pub -h weike-iot.com -p 2262 -u "l3ie6juxf0t9wn8kjsk4" -t v1/devices/me/telemetry -m '{"temperature":66.66, "humidity":88.88}'
pubTopic="v1/devices/me/telemetry"
pubQos=0
# Publisher上报传感器数据的周期,单位是秒
interval=60
interval=600
[subsciber]