mirror of
https://git.beihong.wang/wangbeihong/iot-bedroom-environment-controller.git
synced 2026-04-23 18:03:04 +08:00
能用,自动没测,不想改了,崩溃了
This commit is contained in:
@@ -1,136 +1,94 @@
|
||||
#include <string.h>
|
||||
#include "vars.h"
|
||||
|
||||
char air_temperature[100] = { 0 };
|
||||
static char time[100] = {0};
|
||||
|
||||
const char *get_var_air_temperature() {
|
||||
return air_temperature;
|
||||
const char *get_var_time()
|
||||
{
|
||||
return time;
|
||||
}
|
||||
|
||||
void set_var_air_temperature(const char *value) {
|
||||
strncpy(air_temperature, value, sizeof(air_temperature) / sizeof(char));
|
||||
air_temperature[sizeof(air_temperature) / sizeof(char) - 1] = 0;
|
||||
void set_var_time(const char *value)
|
||||
{
|
||||
strncpy(time, value, sizeof(time) / sizeof(char));
|
||||
time[sizeof(time) / sizeof(char) - 1] = 0;
|
||||
}
|
||||
|
||||
char air_humidity[100] = { 0 };
|
||||
static char humity[100] = {0};
|
||||
|
||||
const char *get_var_air_humidity() {
|
||||
return air_humidity;
|
||||
const char *get_var_humity()
|
||||
{
|
||||
return humity;
|
||||
}
|
||||
|
||||
void set_var_air_humidity(const char *value) {
|
||||
strncpy(air_humidity, value, sizeof(air_humidity) / sizeof(char));
|
||||
air_humidity[sizeof(air_humidity) / sizeof(char) - 1] = 0;
|
||||
void set_var_humity(const char *value)
|
||||
{
|
||||
strncpy(humity, value, sizeof(humity) / sizeof(char));
|
||||
humity[sizeof(humity) / sizeof(char) - 1] = 0;
|
||||
}
|
||||
|
||||
static char light_value[100] = {0};
|
||||
|
||||
const char *get_var_light_value()
|
||||
{
|
||||
return light_value;
|
||||
}
|
||||
|
||||
void set_var_light_value(const char *value)
|
||||
{
|
||||
strncpy(light_value, value, sizeof(light_value) / sizeof(char));
|
||||
light_value[sizeof(light_value) / sizeof(char) - 1] = 0;
|
||||
}
|
||||
|
||||
static char co2_value[100] = {0};
|
||||
|
||||
const char *get_var_co2_value()
|
||||
{
|
||||
return co2_value;
|
||||
}
|
||||
|
||||
void set_var_co2_value(const char *value)
|
||||
{
|
||||
strncpy(co2_value, value, sizeof(co2_value) / sizeof(char));
|
||||
co2_value[sizeof(co2_value) / sizeof(char) - 1] = 0;
|
||||
}
|
||||
|
||||
|
||||
char soil_moisture[100] = { 0 };
|
||||
static char voc_value[100] = { 0 };
|
||||
|
||||
const char *get_var_soil_moisture() {
|
||||
return soil_moisture;
|
||||
const char *get_var_voc_value() {
|
||||
return voc_value;
|
||||
}
|
||||
|
||||
void set_var_soil_moisture(const char *value) {
|
||||
strncpy(soil_moisture, value, sizeof(soil_moisture) / sizeof(char));
|
||||
soil_moisture[sizeof(soil_moisture) / sizeof(char) - 1] = 0;
|
||||
}
|
||||
|
||||
char light_intensity[100] = { 0 };
|
||||
|
||||
const char *get_var_light_intensity() {
|
||||
return light_intensity;
|
||||
}
|
||||
|
||||
void set_var_light_intensity(const char *value) {
|
||||
strncpy(light_intensity, value, sizeof(light_intensity) / sizeof(char));
|
||||
light_intensity[sizeof(light_intensity) / sizeof(char) - 1] = 0;
|
||||
}
|
||||
|
||||
bool wifi_disconnected;
|
||||
|
||||
bool get_var_wifi_disconnected() {
|
||||
return wifi_disconnected;
|
||||
}
|
||||
|
||||
void set_var_wifi_disconnected(bool value) {
|
||||
wifi_disconnected = value;
|
||||
void set_var_voc_value(const char *value) {
|
||||
strncpy(voc_value, value, sizeof(voc_value) / sizeof(char));
|
||||
voc_value[sizeof(voc_value) / sizeof(char) - 1] = 0;
|
||||
}
|
||||
|
||||
|
||||
bool wifi_connected;
|
||||
|
||||
bool get_var_wifi_connected() {
|
||||
return wifi_connected;
|
||||
static char mode[100] = {0};
|
||||
|
||||
const char *get_var_mode()
|
||||
{
|
||||
return mode;
|
||||
}
|
||||
|
||||
void set_var_wifi_connected(bool value) {
|
||||
wifi_connected = value;
|
||||
void set_var_mode(const char *value)
|
||||
{
|
||||
strncpy(mode, value, sizeof(mode) / sizeof(char));
|
||||
mode[sizeof(mode) / sizeof(char) - 1] = 0;
|
||||
}
|
||||
|
||||
static char tempture[100] = {0};
|
||||
|
||||
bool mqtt_connected;
|
||||
|
||||
bool get_var_mqtt_connected() {
|
||||
return mqtt_connected;
|
||||
const char *get_var_tempture()
|
||||
{
|
||||
return tempture;
|
||||
}
|
||||
|
||||
void set_var_mqtt_connected(bool value) {
|
||||
mqtt_connected = value;
|
||||
}
|
||||
|
||||
|
||||
bool mqtt_disconnected;
|
||||
|
||||
bool get_var_mqtt_disconnected() {
|
||||
return mqtt_disconnected;
|
||||
}
|
||||
|
||||
void set_var_mqtt_disconnected(bool value) {
|
||||
mqtt_disconnected = value;
|
||||
}
|
||||
|
||||
|
||||
char iot_net_info[100] = { 0 };
|
||||
|
||||
const char *get_var_iot_net_info() {
|
||||
return iot_net_info;
|
||||
}
|
||||
|
||||
void set_var_iot_net_info(const char *value) {
|
||||
strncpy(iot_net_info, value, sizeof(iot_net_info) / sizeof(char));
|
||||
iot_net_info[sizeof(iot_net_info) / sizeof(char) - 1] = 0;
|
||||
}
|
||||
|
||||
char sntp_time[100] = { 0 };
|
||||
|
||||
const char *get_var_sntp_time() {
|
||||
return sntp_time;
|
||||
}
|
||||
|
||||
void set_var_sntp_time(const char *value) {
|
||||
strncpy(sntp_time, value, sizeof(sntp_time) / sizeof(char));
|
||||
sntp_time[sizeof(sntp_time) / sizeof(char) - 1] = 0;
|
||||
}
|
||||
|
||||
char air_temp_num[100] = { 0 };
|
||||
|
||||
const char *get_var_air_temp_num() {
|
||||
return air_temp_num;
|
||||
}
|
||||
|
||||
void set_var_air_temp_num(const char *value) {
|
||||
strncpy(air_temp_num, value, sizeof(air_temp_num) / sizeof(char));
|
||||
air_temp_num[sizeof(air_temp_num) / sizeof(char) - 1] = 0;
|
||||
}
|
||||
|
||||
|
||||
char soil_mois_num[100] = { 0 };
|
||||
|
||||
const char *get_var_soil_mois_num() {
|
||||
return soil_mois_num;
|
||||
}
|
||||
|
||||
void set_var_soil_mois_num(const char *value) {
|
||||
strncpy(soil_mois_num, value, sizeof(soil_mois_num) / sizeof(char));
|
||||
soil_mois_num[sizeof(soil_mois_num) / sizeof(char) - 1] = 0;
|
||||
void set_var_tempture(const char *value)
|
||||
{
|
||||
strncpy(tempture, value, sizeof(tempture) / sizeof(char));
|
||||
tempture[sizeof(tempture) / sizeof(char) - 1] = 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user