一.项目介绍
油罐车数据采集,由于油罐车属于危险运输车辆,所以加强对油罐车数据监控可以防范事故的发生,本次通过TencentOS Tiny系统,内部的MQTT协议,对采集到的数据进行上传至腾讯云平台,通过腾讯连连即可实时看到数据信息。目前只是设计了罐车测的部分数据的采集上传,主要有GPS数据,对GPS中数据解析,如得到经纬度数据,速度信息。对压力传感器(4-20ma)的电流进行采集,光照度,温湿度数据进行采集,。
二.项目整体架构
整体就是这样的,使用的数据接口都是板子上的一个E53拓展接口,使用了GPIO和ADC,光照度和温湿度都是采用了一个IIC接口,GPS数据只用到了串口5的接收数据。
三.硬件组成
1. IMXRT1062
首先最主要的就是这款TencentOS Tiny AIoT开发套件,其使用了NXP的跨界处理器,IMXRT1062。其外部接口很丰富,除了上面的E53接口,其还有摄像头接口,音频接口,预留ESP8266接口,还有一个RGB转HDMI接口,同时还有PCI-e Module,可以外接模块,此款处理器也是可以跑图像识别的处理算法。
2.压力变送器
压力传感器,罐车一般可以使用4-20ma输出的,这样采集简单,同时4-20ma也不会达到易燃物的闪点。本次就是做了ADC功能,采集数据上传,当然我们外界电路,可以检测电流,换算压力,同时4ma可以帮助我们检测断线问题。
3.温湿度传感器
温湿度传感器,本次采用的是SHT20模块,通过和光照度传感器一致接口进行读数。
4.GPS模块
GPS模块采用的是Air530模块,其数据是自己回传的,一秒一次这样的。同时模块直接就包含了天线。我们通过GPS模块可以获得当前车辆位置信息,行驶速度信息等。
5. 未使用的,后期可以添加1. (已添加显示屏)
未使用到LCD,实际这几个数据通过LCD最方便获取,由于LVGL移植一致没通过所以本次先不用LCD显示了,所有数据我通过串口也输出显示了下。后期学习下别人的,可以添加到其中来。
昨天通知进决赛了,所以决定修改下屏幕,试着让显示屏亮起来,本次还是通过LVGL的移植。先看下效果。
目前创建了几个仪表,目前通过显示屏直接显示获得的数据,还是很清晰的,其中加入了温度湿度,压力,速度的显示。同时经纬度也是放在上面进行了显示。
四.项目中代码介绍以及测试结果
首先是在代码中初始化了三个任务,一个是MQTT数据上传和解析,一个用来读取ADC获取的值,还有一个是定时的解析串口收到的GPS数据。
代码语言:javascript复制#include "sht20.h"
const int16_t POLYNOMIAL = 0x131;
SHT20_INFO sht20Info;
static int I2C_WriteByte(unsigned char slaveAddr, unsigned char regAddr, unsigned char *byte)
{
status_t reVal = kStatus_Fail;
/* Send master blocking data to slave */
if (kStatus_Success != LPI2C_MasterStart(SHT20_I2C_MASTER, slaveAddr, kLPI2C_Write))
{
return -1;
}
/* Check communicate with slave successful or not */
if (LPI2C_MasterGetStatusFlags(SHT20_I2C_MASTER) & kLPI2C_MasterNackDetectFlag)
{
return kStatus_LPI2C_Nak;
}
reVal = LPI2C_MasterSend(SHT20_I2C_MASTER, (uint8_t *)®Addr, 1);
if (reVal != kStatus_Success)
{
if (reVal == kStatus_LPI2C_Nak)
{
LPI2C_MasterStop(SHT20_I2C_MASTER);
}
return -1;
}
if(byte)
{
reVal = LPI2C_MasterSend(SHT20_I2C_MASTER, (uint8_t *)byte, 1);
if (reVal != kStatus_Success)
{
if (reVal == kStatus_LPI2C_Nak)
{
LPI2C_MasterStop(SHT20_I2C_MASTER);
}
return -1;
}
}
reVal = LPI2C_MasterStop(SHT20_I2C_MASTER);
if (reVal != kStatus_Success)
{
return -1;
}
return 0;
}
static int I2C_ReadByte(unsigned char slaveAddr, unsigned char regAddr, unsigned char *val)
{
status_t reVal = kStatus_Fail;
if (kStatus_Success != LPI2C_MasterStart(SHT20_I2C_MASTER, slaveAddr, kLPI2C_Write)) { //起始信号
return -1;
}
/* Check communicate with slave successful or not */
if (LPI2C_MasterGetStatusFlags(SHT20_I2C_MASTER) & kLPI2C_MasterNackDetectFlag) //等待应答
{
return kStatus_LPI2C_Nak;
}
reVal = LPI2C_MasterSend(SHT20_I2C_MASTER, (uint8_t *)®Addr, 1); //发送寄存器地址
if (reVal != kStatus_Success) //等待应答
{
if (reVal == kStatus_LPI2C_Nak)
{
LPI2C_MasterStop(SHT20_I2C_MASTER);
}
return -1;
}
if (kStatus_Success != LPI2C_MasterStart(SHT20_I2C_MASTER, slaveAddr, kLPI2C_Read)) { //发送设备地址(读)
return -1;
}
reVal = LPI2C_MasterReceive(SHT20_I2C_MASTER, val, 1); //接收
if (reVal != kStatus_Success)
{
if (reVal == kStatus_LPI2C_Nak)
{
LPI2C_MasterStop(SHT20_I2C_MASTER);
}
return -1;
}
reVal = LPI2C_MasterStop(SHT20_I2C_MASTER);
if (reVal != kStatus_Success)
{
return -1;
}
return 0;
}
static void SHT20_reset(void)
{
I2C_WriteByte(SHT20_ADDRESS, SHT20_SOFT_RESET, (void *)0);
}
unsigned char SHT20_read_user_reg(void)
{
unsigned char val = 0;
I2C_ReadByte(SHT20_ADDRESS, SHT20_READ_REG, &val);
return val;
}
char SHT2x_CheckCrc(char data[], char nbrOfBytes, char checksum)
{
char crc = 0;
char bit = 0;
char byteCtr = 0;
//calculates 8-Bit checksum with given polynomial
for(byteCtr = 0; byteCtr < nbrOfBytes; byteCtr)
{
crc ^= (data[byteCtr]);
for ( bit = 8; bit > 0; --bit)
{
if (crc & 0x80) crc = (crc << 1) ^ POLYNOMIAL;
else crc = (crc << 1);
}
}
if(crc != checksum)
return 1;
else
return 0;
}
float SHT2x_CalcTemperatureC(unsigned short u16sT)
{
float temperatureC = 0; // variable for result
u16sT &= ~0x0003; // clear bits [1..0] (status bits)
//-- calculate temperature [癈] --
temperatureC = -46.85 175.72 / 65536 * (float)u16sT; //T= -46.85 175.72 * ST/2^16
return temperatureC;
}
float SHT2x_CalcRH(unsigned short u16sRH)
{
float humidityRH = 0; // variable for result
u16sRH &= ~0x0003; // clear bits [1..0] (status bits)
//-- calculate relative humidity [%RH] --
//humidityRH = -6.0 125.0/65536 * (float)u16sRH; // RH= -6 125 * SRH/2^16
humidityRH = ((float)u16sRH * 0.00190735) - 6;
return humidityRH;
}
float SHT2x_MeasureHM(unsigned char cmd, unsigned short *pMeasurand)
{
char checksum = 0; //checksum
char data[2]; //data array for checksum verification
unsigned char addr = 0;
unsigned short tmp = 0;
float t = 0;
status_t reVal = kStatus_Fail;
if (kStatus_Success != LPI2C_MasterStart(SHT20_I2C_MASTER, SHT20_ADDRESS, kLPI2C_Write)) {
return -1;
}
/* Check communicate with slave successful or not */
if (LPI2C_MasterGetStatusFlags(SHT20_I2C_MASTER) & kLPI2C_MasterNackDetectFlag)
{
return kStatus_LPI2C_Nak;
}
reVal = LPI2C_MasterSend(SHT20_I2C_MASTER, (uint8_t *)&cmd, 1); //发送寄存器地址
if (reVal != kStatus_Success) //等待应答
{
if (reVal == kStatus_LPI2C_Nak)
{
LPI2C_MasterStop(SHT20_I2C_MASTER);
}
return -1;
}
if (kStatus_Success != LPI2C_MasterStart(SHT20_I2C_MASTER, SHT20_ADDRESS, kLPI2C_Read)) {
return -1;
}
/* Check communicate with slave successful or not */
if (LPI2C_MasterGetStatusFlags(SHT20_I2C_MASTER) & kLPI2C_MasterNackDetectFlag)
{
return kStatus_LPI2C_Nak;
}
tos_task_delay(75);
reVal = LPI2C_MasterReceive(SHT20_I2C_MASTER, data, 2); //接收
if (reVal != kStatus_Success)
{
if (reVal == kStatus_LPI2C_Nak)
{
LPI2C_MasterStop(SHT20_I2C_MASTER);
}
return -1;
}
reVal = LPI2C_MasterReceive(SHT20_I2C_MASTER, &checksum, 1); //接收
if (reVal != kStatus_Success)
{
if (reVal == kStatus_LPI2C_Nak)
{
LPI2C_MasterStop(SHT20_I2C_MASTER);
}
return -1;
}
reVal = LPI2C_MasterStop(SHT20_I2C_MASTER);
if (reVal != kStatus_Success)
{
return -1;
}
SHT2x_CheckCrc(data, 2, checksum);
tmp = (data[0] << 8) data[1];
if(cmd == SHT20_Measurement_T_HM)
{
t = SHT2x_CalcTemperatureC(tmp);
}
else
{
t = SHT2x_CalcRH(tmp);
}
if(pMeasurand)
{
*pMeasurand = (unsigned short)t;
}
return t;
}
void SHT20_GetValue(float *temp,float *humi)
{
unsigned char i = 0;
SHT20_read_user_reg();
tos_task_delay(10);
*temp = SHT2x_MeasureHM(SHT20_Measurement_T_HM, (void *)0);
tos_task_delay(75);
*humi = SHT2x_MeasureHM(SHT20_Measurement_RH_HM, (void *)0);
tos_task_delay(30);
SHT20_read_user_reg();
tos_task_delay(30);
I2C_WriteByte(SHT20_ADDRESS, SHT20_WRITE_REG, &i);
tos_task_delay(1);
SHT20_read_user_reg();
tos_task_delay(1);
SHT20_reset();
tos_task_delay(1);
}
我在其基础上增加了一个SHT20温湿度模块,上面就是获取模块传感器的值。
温湿度和光照度数据。可以看到和米家的对比也基本是一致的。
代码语言:javascript复制void adc_get_value(void)
{
adc_channel_config_t adcChannelConfigStruct;
adcChannelConfigStruct.channelNumber = DEMO_ADC_USER_CHANNEL;
adcChannelConfigStruct.enableInterruptOnConversionCompleted = false;
while(1)
{
ADC_SetChannelConfig(DEMO_ADC_BASE, DEMO_ADC_CHANNEL_GROUP, &adcChannelConfigStruct);
while (0U == ADC_GetChannelStatusFlags(DEMO_ADC_BASE, DEMO_ADC_CHANNEL_GROUP))
{
}
adc = ADC_GetChannelConversionValue(DEMO_ADC_BASE, DEMO_ADC_CHANNEL_GROUP);
// printf("ADC Value: %drn", );
tos_task_delay(1000);
}
}
void application_adc(void *arg)
{
adc_get_value();
while (1) {
printf("This is a mqtt demo!rn");
tos_task_delay(1000);
}
}
ADC部分代码。12位的ADC,我发现其值有所跳动。
GPS部分,我用了定时器获取其接收的数据,并通过NMEA开源的代码进行解析的。
这是GPS解析出的数据,和上位机中的数据是一致的。
LVGL的显示任务
目前可以使用官方的设计器来进行设计,最终导出的话,最新版本可以支持Keil了。所以还是很方便的。
代码语言:javascript复制/*
* Copyright 2022 NXP
* SPDX-License-Identifier: MIT
*/
#include "lvgl/lvgl.h"
#include <stdio.h>
#include "gui_guider.h"
#include "events_init.h"
#include "custom.h"
void setup_scr_screen(lv_ui *ui){
//Write codes screen
ui->screen = lv_obj_create(NULL, NULL);
//Write style LV_OBJ_PART_MAIN for screen
static lv_style_t style_screen_main;
lv_style_reset(&style_screen_main);
//Write style state: LV_STATE_DEFAULT for style_screen_main
lv_style_set_bg_color(&style_screen_main, LV_STATE_DEFAULT, lv_color_make(0xff, 0xff, 0xff));
lv_style_set_bg_opa(&style_screen_main, LV_STATE_DEFAULT, 0);
lv_obj_add_style(ui->screen, LV_OBJ_PART_MAIN, &style_screen_main);
//Write codes screen_label_temp
ui->screen_label_temp = lv_label_create(ui->screen, NULL);
lv_label_set_text(ui->screen_label_temp, "温度");
lv_label_set_long_mode(ui->screen_label_temp, LV_LABEL_LONG_BREAK);
lv_label_set_align(ui->screen_label_temp, LV_LABEL_ALIGN_CENTER);
//Write style LV_LABEL_PART_MAIN for screen_label_temp
static lv_style_t style_screen_label_temp_main;
lv_style_reset(&style_screen_label_temp_main);
//Write style state: LV_STATE_DEFAULT for style_screen_label_temp_main
lv_style_set_radius(&style_screen_label_temp_main, LV_STATE_DEFAULT, 0);
lv_style_set_bg_color(&style_screen_label_temp_main, LV_STATE_DEFAULT, lv_color_make(0xff, 0xff, 0xff));
lv_style_set_bg_grad_color(&style_screen_label_temp_main, LV_STATE_DEFAULT, lv_color_make(0xff, 0xff, 0xff));
lv_style_set_bg_grad_dir(&style_screen_label_temp_main, LV_STATE_DEFAULT, LV_GRAD_DIR_VER);
lv_style_set_bg_opa(&style_screen_label_temp_main, LV_STATE_DEFAULT, 255);
lv_style_set_text_color(&style_screen_label_temp_main, LV_STATE_DEFAULT, lv_color_make(0x00, 0x00, 0x00));
lv_style_set_text_font(&style_screen_label_temp_main, LV_STATE_DEFAULT, &lv_font_simsun_20);
lv_style_set_text_letter_space(&style_screen_label_temp_main, LV_STATE_DEFAULT, 2);
lv_style_set_pad_left(&style_screen_label_temp_main, LV_STATE_DEFAULT, 0);
lv_style_set_pad_right(&style_screen_label_temp_main, LV_STATE_DEFAULT, 0);
lv_style_set_pad_top(&style_screen_label_temp_main, LV_STATE_DEFAULT, 0);
lv_style_set_pad_bottom(&style_screen_label_temp_main, LV_STATE_DEFAULT, 0);
lv_obj_add_style(ui->screen_label_temp, LV_LABEL_PART_MAIN, &style_screen_label_temp_main);
lv_obj_set_pos(ui->screen_label_temp, 43, 277);
lv_obj_set_size(ui->screen_label_temp, 100, 0);
//Write codes screen_label_project_name
ui->screen_label_project_name = lv_label_create(ui->screen, NULL);
lv_label_set_text(ui->screen_label_project_name, "基于TencentOS Tiny 油罐车数据采集");
lv_label_set_long_mode(ui->screen_label_project_name, LV_LABEL_LONG_BREAK);
lv_label_set_align(ui->screen_label_project_name, LV_LABEL_ALIGN_CENTER);
//Write style LV_LABEL_PART_MAIN for screen_label_project_name
static lv_style_t style_screen_label_project_name_main;
lv_style_reset(&style_screen_label_project_name_main);
//Write style state: LV_STATE_DEFAULT for style_screen_label_project_name_main
lv_style_set_radius(&style_screen_label_project_name_main, LV_STATE_DEFAULT, 0);
lv_style_set_bg_color(&style_screen_label_project_name_main, LV_STATE_DEFAULT, lv_color_make(0xff, 0xff, 0xff));
lv_style_set_bg_grad_color(&style_screen_label_project_name_main, LV_STATE_DEFAULT, lv_color_make(0xff, 0xff, 0xff));
lv_style_set_bg_grad_dir(&style_screen_label_project_name_main, LV_STATE_DEFAULT, LV_GRAD_DIR_VER);
lv_style_set_bg_opa(&style_screen_label_project_name_main, LV_STATE_DEFAULT, 255);
lv_style_set_text_color(&style_screen_label_project_name_main, LV_STATE_DEFAULT, lv_color_make(0x00, 0x00, 0x00));
lv_style_set_text_font(&style_screen_label_project_name_main, LV_STATE_DEFAULT, &lv_font_simsun_20);
lv_style_set_text_letter_space(&style_screen_label_project_name_main, LV_STATE_DEFAULT, 2);
lv_style_set_pad_left(&style_screen_label_project_name_main, LV_STATE_DEFAULT, 0);
lv_style_set_pad_right(&style_screen_label_project_name_main, LV_STATE_DEFAULT, 0);
lv_style_set_pad_top(&style_screen_label_project_name_main, LV_STATE_DEFAULT, 0);
lv_style_set_pad_bottom(&style_screen_label_project_name_main, LV_STATE_DEFAULT, 0);
lv_obj_add_style(ui->screen_label_project_name, LV_LABEL_PART_MAIN, &style_screen_label_project_name_main);
lv_obj_set_pos(ui->screen_label_project_name, 196, 17);
lv_obj_set_size(ui->screen_label_project_name, 443, 0);
//Write codes screen_gauge_temp
ui->screen_gauge_temp = lv_gauge_create(ui->screen, NULL);
//Write style LV_GAUGE_PART_MAIN for screen_gauge_temp
static lv_style_t style_screen_gauge_temp_main;
lv_style_reset(&style_screen_gauge_temp_main);
//Write style state: LV_STATE_DEFAULT for style_screen_gauge_temp_main
lv_style_set_bg_color(&style_screen_gauge_temp_main, LV_STATE_DEFAULT, lv_color_make(0x00, 0x75, 0xdb));
lv_style_set_bg_grad_color(&style_screen_gauge_temp_main, LV_STATE_DEFAULT, lv_color_make(0xff, 0xff, 0xff));
lv_style_set_bg_grad_dir(&style_screen_gauge_temp_main, LV_STATE_DEFAULT, LV_GRAD_DIR_VER);
lv_style_set_bg_opa(&style_screen_gauge_temp_main, LV_STATE_DEFAULT, 255);
lv_style_set_text_color(&style_screen_gauge_temp_main, LV_STATE_DEFAULT, lv_color_make(0x39, 0x3c, 0x41));
lv_style_set_text_font(&style_screen_gauge_temp_main, LV_STATE_DEFAULT, &lv_font_simsun_12);
lv_style_set_text_letter_space(&style_screen_gauge_temp_main, LV_STATE_DEFAULT, 0);
lv_style_set_pad_inner(&style_screen_gauge_temp_main, LV_STATE_DEFAULT, 15);
lv_style_set_line_color(&style_screen_gauge_temp_main, LV_STATE_DEFAULT, lv_color_make(0x8b, 0x89, 0x8b));
lv_style_set_line_width(&style_screen_gauge_temp_main, LV_STATE_DEFAULT, 3);
lv_style_set_line_opa(&style_screen_gauge_temp_main, LV_STATE_DEFAULT, 255);
lv_style_set_scale_grad_color(&style_screen_gauge_temp_main, LV_STATE_DEFAULT, lv_color_make(0x8b, 0x89, 0x8b));
lv_style_set_scale_end_color(&style_screen_gauge_temp_main, LV_STATE_DEFAULT, lv_color_make(0x00, 0xa1, 0xb5));
lv_style_set_scale_width(&style_screen_gauge_temp_main, LV_STATE_DEFAULT, 9);
lv_style_set_scale_border_width(&style_screen_gauge_temp_main, LV_STATE_DEFAULT, 0);
lv_style_set_scale_end_border_width(&style_screen_gauge_temp_main, LV_STATE_DEFAULT, 5);
lv_style_set_scale_end_line_width(&style_screen_gauge_temp_main, LV_STATE_DEFAULT, 4);
lv_obj_add_style(ui->screen_gauge_temp, LV_GAUGE_PART_MAIN, &style_screen_gauge_temp_main);
//Write style LV_GAUGE_PART_MAJOR for screen_gauge_temp
static lv_style_t style_screen_gauge_temp_major;
lv_style_reset(&style_screen_gauge_temp_major);
//Write style state: LV_STATE_DEFAULT for style_screen_gauge_temp_major
lv_style_set_line_color(&style_screen_gauge_temp_major, LV_STATE_DEFAULT, lv_color_make(0x8b, 0x89, 0x8b));
lv_style_set_line_width(&style_screen_gauge_temp_major, LV_STATE_DEFAULT, 5);
lv_style_set_line_opa(&style_screen_gauge_temp_major, LV_STATE_DEFAULT, 255);
lv_style_set_scale_grad_color(&style_screen_gauge_temp_major, LV_STATE_DEFAULT, lv_color_make(0x8b, 0x89, 0x8b));
lv_style_set_scale_end_color(&style_screen_gauge_temp_major, LV_STATE_DEFAULT, lv_color_make(0x00, 0xa1, 0xb5));
lv_style_set_scale_width(&style_screen_gauge_temp_major, LV_STATE_DEFAULT, 16);
lv_style_set_scale_end_line_width(&style_screen_gauge_temp_major, LV_STATE_DEFAULT, 5);
lv_obj_add_style(ui->screen_gauge_temp, LV_GAUGE_PART_MAJOR, &style_screen_gauge_temp_major);
//Write style LV_GAUGE_PART_NEEDLE for screen_gauge_temp
static lv_style_t style_screen_gauge_temp_needle;
lv_style_reset(&style_screen_gauge_temp_needle);
//Write style state: LV_STATE_DEFAULT for style_screen_gauge_temp_needle
lv_style_set_size(&style_screen_gauge_temp_needle, LV_STATE_DEFAULT, 21);
lv_style_set_bg_color(&style_screen_gauge_temp_needle, LV_STATE_DEFAULT, lv_color_make(0x41, 0x48, 0x5a));
lv_style_set_bg_grad_color(&style_screen_gauge_temp_needle, LV_STATE_DEFAULT, lv_color_make(0x41, 0x48, 0x5a));
lv_style_set_bg_grad_dir(&style_screen_gauge_temp_needle, LV_STATE_DEFAULT, LV_GRAD_DIR_VER);
lv_style_set_bg_opa(&style_screen_gauge_temp_needle, LV_STATE_DEFAULT, 255);
lv_style_set_pad_inner(&style_screen_gauge_temp_needle, LV_STATE_DEFAULT, 0);
lv_style_set_line_width(&style_screen_gauge_temp_needle, LV_STATE_DEFAULT, 4);
lv_style_set_line_opa(&style_screen_gauge_temp_needle, LV_STATE_DEFAULT, 255);
lv_obj_add_style(ui->screen_gauge_temp, LV_GAUGE_PART_NEEDLE, &style_screen_gauge_temp_needle);
lv_obj_set_pos(ui->screen_gauge_temp, 6, 63);
lv_obj_set_size(ui->screen_gauge_temp, 184, 184);
lv_gauge_set_scale(ui->screen_gauge_temp, 300, 71, 8);
lv_gauge_set_range(ui->screen_gauge_temp, 0, 70);
static lv_color_t needle_colors_screen_gauge_temp[1];
needle_colors_screen_gauge_temp[0] = lv_color_make(0xff, 0x00, 0x00);
lv_gauge_set_needle_count(ui->screen_gauge_temp, 1, needle_colors_screen_gauge_temp);
lv_gauge_set_critical_value(ui->screen_gauge_temp, 40);
lv_gauge_set_value(ui->screen_gauge_temp, 0, 0);
//Write codes screen_gauge_humi
ui->screen_gauge_humi = lv_gauge_create(ui->screen, NULL);
//Write style LV_GAUGE_PART_MAIN for screen_gauge_humi
static lv_style_t style_screen_gauge_humi_main;
lv_style_reset(&style_screen_gauge_humi_main);
//Write style state: LV_STATE_DEFAULT for style_screen_gauge_humi_main
lv_style_set_bg_color(&style_screen_gauge_humi_main, LV_STATE_DEFAULT, lv_color_make(0x00, 0x75, 0xdb));
lv_style_set_bg_grad_color(&style_screen_gauge_humi_main, LV_STATE_DEFAULT, lv_color_make(0xff, 0xff, 0xff));
lv_style_set_bg_grad_dir(&style_screen_gauge_humi_main, LV_STATE_DEFAULT, LV_GRAD_DIR_VER);
lv_style_set_bg_opa(&style_screen_gauge_humi_main, LV_STATE_DEFAULT, 255);
lv_style_set_text_color(&style_screen_gauge_humi_main, LV_STATE_DEFAULT, lv_color_make(0x39, 0x3c, 0x41));
lv_style_set_text_font(&style_screen_gauge_humi_main, LV_STATE_DEFAULT, &lv_font_simsun_12);
lv_style_set_text_letter_space(&style_screen_gauge_humi_main, LV_STATE_DEFAULT, 0);
lv_style_set_pad_inner(&style_screen_gauge_humi_main, LV_STATE_DEFAULT, 15);
lv_style_set_line_color(&style_screen_gauge_humi_main, LV_STATE_DEFAULT, lv_color_make(0x8b, 0x89, 0x8b));
lv_style_set_line_width(&style_screen_gauge_humi_main, LV_STATE_DEFAULT, 3);
lv_style_set_line_opa(&style_screen_gauge_humi_main, LV_STATE_DEFAULT, 255);
lv_style_set_scale_grad_color(&style_screen_gauge_humi_main, LV_STATE_DEFAULT, lv_color_make(0x8b, 0x89, 0x8b));
lv_style_set_scale_end_color(&style_screen_gauge_humi_main, LV_STATE_DEFAULT, lv_color_make(0x00, 0xa1, 0xb5));
lv_style_set_scale_width(&style_screen_gauge_humi_main, LV_STATE_DEFAULT, 9);
lv_style_set_scale_border_width(&style_screen_gauge_humi_main, LV_STATE_DEFAULT, 0);
lv_style_set_scale_end_border_width(&style_screen_gauge_humi_main, LV_STATE_DEFAULT, 5);
lv_style_set_scale_end_line_width(&style_screen_gauge_humi_main, LV_STATE_DEFAULT, 4);
lv_obj_add_style(ui->screen_gauge_humi, LV_GAUGE_PART_MAIN, &style_screen_gauge_humi_main);
//Write style LV_GAUGE_PART_MAJOR for screen_gauge_humi
static lv_style_t style_screen_gauge_humi_major;
lv_style_reset(&style_screen_gauge_humi_major);
//Write style state: LV_STATE_DEFAULT for style_screen_gauge_humi_major
lv_style_set_line_color(&style_screen_gauge_humi_major, LV_STATE_DEFAULT, lv_color_make(0x8b, 0x89, 0x8b));
lv_style_set_line_width(&style_screen_gauge_humi_major, LV_STATE_DEFAULT, 5);
lv_style_set_line_opa(&style_screen_gauge_humi_major, LV_STATE_DEFAULT, 255);
lv_style_set_scale_grad_color(&style_screen_gauge_humi_major, LV_STATE_DEFAULT, lv_color_make(0x8b, 0x89, 0x8b));
lv_style_set_scale_end_color(&style_screen_gauge_humi_major, LV_STATE_DEFAULT, lv_color_make(0x00, 0xa1, 0xb5));
lv_style_set_scale_width(&style_screen_gauge_humi_major, LV_STATE_DEFAULT, 16);
lv_style_set_scale_end_line_width(&style_screen_gauge_humi_major, LV_STATE_DEFAULT, 5);
lv_obj_add_style(ui->screen_gauge_humi, LV_GAUGE_PART_MAJOR, &style_screen_gauge_humi_major);
//Write style LV_GAUGE_PART_NEEDLE for screen_gauge_humi
static lv_style_t style_screen_gauge_humi_needle;
lv_style_reset(&style_screen_gauge_humi_needle);
//Write style state: LV_STATE_DEFAULT for style_screen_gauge_humi_needle
lv_style_set_size(&style_screen_gauge_humi_needle, LV_STATE_DEFAULT, 21);
lv_style_set_bg_color(&style_screen_gauge_humi_needle, LV_STATE_DEFAULT, lv_color_make(0x41, 0x48, 0x5a));
lv_style_set_bg_grad_color(&style_screen_gauge_humi_needle, LV_STATE_DEFAULT, lv_color_make(0x41, 0x48, 0x5a));
lv_style_set_bg_grad_dir(&style_screen_gauge_humi_needle, LV_STATE_DEFAULT, LV_GRAD_DIR_VER);
lv_style_set_bg_opa(&style_screen_gauge_humi_needle, LV_STATE_DEFAULT, 255);
lv_style_set_pad_inner(&style_screen_gauge_humi_needle, LV_STATE_DEFAULT, 0);
lv_style_set_line_width(&style_screen_gauge_humi_needle, LV_STATE_DEFAULT, 4);
lv_style_set_line_opa(&style_screen_gauge_humi_needle, LV_STATE_DEFAULT, 255);
lv_obj_add_style(ui->screen_gauge_humi, LV_GAUGE_PART_NEEDLE, &style_screen_gauge_humi_needle);
lv_obj_set_pos(ui->screen_gauge_humi, 200, 65);
lv_obj_set_size(ui->screen_gauge_humi, 182, 182);
lv_gauge_set_scale(ui->screen_gauge_humi, 300, 21, 11);
lv_gauge_set_range(ui->screen_gauge_humi, 0, 100);
static lv_color_t needle_colors_screen_gauge_humi[1];
needle_colors_screen_gauge_humi[0] = lv_color_make(0xff, 0x00, 0x00);
lv_gauge_set_needle_count(ui->screen_gauge_humi, 1, needle_colors_screen_gauge_humi);
lv_gauge_set_critical_value(ui->screen_gauge_humi, 80);
lv_gauge_set_value(ui->screen_gauge_humi, 0, 0);
//Write codes screen_gauge_press
ui->screen_gauge_press = lv_gauge_create(ui->screen, NULL);
//Write style LV_GAUGE_PART_MAIN for screen_gauge_press
static lv_style_t style_screen_gauge_press_main;
lv_style_reset(&style_screen_gauge_press_main);
//Write style state: LV_STATE_DEFAULT for style_screen_gauge_press_main
lv_style_set_bg_color(&style_screen_gauge_press_main, LV_STATE_DEFAULT, lv_color_make(0x00, 0x75, 0xdb));
lv_style_set_bg_grad_color(&style_screen_gauge_press_main, LV_STATE_DEFAULT, lv_color_make(0xff, 0xff, 0xff));
lv_style_set_bg_grad_dir(&style_screen_gauge_press_main, LV_STATE_DEFAULT, LV_GRAD_DIR_VER);
lv_style_set_bg_opa(&style_screen_gauge_press_main, LV_STATE_DEFAULT, 255);
lv_style_set_text_color(&style_screen_gauge_press_main, LV_STATE_DEFAULT, lv_color_make(0x39, 0x3c, 0x41));
lv_style_set_text_font(&style_screen_gauge_press_main, LV_STATE_DEFAULT, &lv_font_simsun_12);
lv_style_set_text_letter_space(&style_screen_gauge_press_main, LV_STATE_DEFAULT, 0);
lv_style_set_pad_inner(&style_screen_gauge_press_main, LV_STATE_DEFAULT, 15);
lv_style_set_line_color(&style_screen_gauge_press_main, LV_STATE_DEFAULT, lv_color_make(0x8b, 0x89, 0x8b));
lv_style_set_line_width(&style_screen_gauge_press_main, LV_STATE_DEFAULT, 3);
lv_style_set_line_opa(&style_screen_gauge_press_main, LV_STATE_DEFAULT, 255);
lv_style_set_scale_grad_color(&style_screen_gauge_press_main, LV_STATE_DEFAULT, lv_color_make(0x8b, 0x89, 0x8b));
lv_style_set_scale_end_color(&style_screen_gauge_press_main, LV_STATE_DEFAULT, lv_color_make(0x00, 0xa1, 0xb5));
lv_style_set_scale_width(&style_screen_gauge_press_main, LV_STATE_DEFAULT, 9);
lv_style_set_scale_border_width(&style_screen_gauge_press_main, LV_STATE_DEFAULT, 0);
lv_style_set_scale_end_border_width(&style_screen_gauge_press_main, LV_STATE_DEFAULT, 5);
lv_style_set_scale_end_line_width(&style_screen_gauge_press_main, LV_STATE_DEFAULT, 4);
lv_obj_add_style(ui->screen_gauge_press, LV_GAUGE_PART_MAIN, &style_screen_gauge_press_main);
//Write style LV_GAUGE_PART_MAJOR for screen_gauge_press
static lv_style_t style_screen_gauge_press_major;
lv_style_reset(&style_screen_gauge_press_major);
//Write style state: LV_STATE_DEFAULT for style_screen_gauge_press_major
lv_style_set_line_color(&style_screen_gauge_press_major, LV_STATE_DEFAULT, lv_color_make(0x8b, 0x89, 0x8b));
lv_style_set_line_width(&style_screen_gauge_press_major, LV_STATE_DEFAULT, 5);
lv_style_set_line_opa(&style_screen_gauge_press_major, LV_STATE_DEFAULT, 255);
lv_style_set_scale_grad_color(&style_screen_gauge_press_major, LV_STATE_DEFAULT, lv_color_make(0x8b, 0x89, 0x8b));
lv_style_set_scale_end_color(&style_screen_gauge_press_major, LV_STATE_DEFAULT, lv_color_make(0x00, 0xa1, 0xb5));
lv_style_set_scale_width(&style_screen_gauge_press_major, LV_STATE_DEFAULT, 16);
lv_style_set_scale_end_line_width(&style_screen_gauge_press_major, LV_STATE_DEFAULT, 5);
lv_obj_add_style(ui->screen_gauge_press, LV_GAUGE_PART_MAJOR, &style_screen_gauge_press_major);
//Write style LV_GAUGE_PART_NEEDLE for screen_gauge_press
static lv_style_t style_screen_gauge_press_needle;
lv_style_reset(&style_screen_gauge_press_needle);
//Write style state: LV_STATE_DEFAULT for style_screen_gauge_press_needle
lv_style_set_size(&style_screen_gauge_press_needle, LV_STATE_DEFAULT, 21);
lv_style_set_bg_color(&style_screen_gauge_press_needle, LV_STATE_DEFAULT, lv_color_make(0x41, 0x48, 0x5a));
lv_style_set_bg_grad_color(&style_screen_gauge_press_needle, LV_STATE_DEFAULT, lv_color_make(0x41, 0x48, 0x5a));
lv_style_set_bg_grad_dir(&style_screen_gauge_press_needle, LV_STATE_DEFAULT, LV_GRAD_DIR_VER);
lv_style_set_bg_opa(&style_screen_gauge_press_needle, LV_STATE_DEFAULT, 255);
lv_style_set_pad_inner(&style_screen_gauge_press_needle, LV_STATE_DEFAULT, 0);
lv_style_set_line_width(&style_screen_gauge_press_needle, LV_STATE_DEFAULT, 4);
lv_style_set_line_opa(&style_screen_gauge_press_needle, LV_STATE_DEFAULT, 255);
lv_obj_add_style(ui->screen_gauge_press, LV_GAUGE_PART_NEEDLE, &style_screen_gauge_press_needle);
lv_obj_set_pos(ui->screen_gauge_press, 399, 64);
lv_obj_set_size(ui->screen_gauge_press, 182, 182);
lv_gauge_set_scale(ui->screen_gauge_press, 300, 21, 11);
lv_gauge_set_range(ui->screen_gauge_press, 0, 1000);
static lv_color_t needle_colors_screen_gauge_press[1];
needle_colors_screen_gauge_press[0] = lv_color_make(0xff, 0x00, 0x00);
lv_gauge_set_needle_count(ui->screen_gauge_press, 1, needle_colors_screen_gauge_press);
lv_gauge_set_critical_value(ui->screen_gauge_press, 360);
lv_gauge_set_value(ui->screen_gauge_press, 0, 0);
//Write codes screen_gauge_speed
ui->screen_gauge_speed = lv_gauge_create(ui->screen, NULL);
//Write style LV_GAUGE_PART_MAIN for screen_gauge_speed
static lv_style_t style_screen_gauge_speed_main;
lv_style_reset(&style_screen_gauge_speed_main);
//Write style state: LV_STATE_DEFAULT for style_screen_gauge_speed_main
lv_style_set_bg_color(&style_screen_gauge_speed_main, LV_STATE_DEFAULT, lv_color_make(0x00, 0x75, 0xdb));
lv_style_set_bg_grad_color(&style_screen_gauge_speed_main, LV_STATE_DEFAULT, lv_color_make(0xff, 0xff, 0xff));
lv_style_set_bg_grad_dir(&style_screen_gauge_speed_main, LV_STATE_DEFAULT, LV_GRAD_DIR_VER);
lv_style_set_bg_opa(&style_screen_gauge_speed_main, LV_STATE_DEFAULT, 255);
lv_style_set_text_color(&style_screen_gauge_speed_main, LV_STATE_DEFAULT, lv_color_make(0x39, 0x3c, 0x41));
lv_style_set_text_font(&style_screen_gauge_speed_main, LV_STATE_DEFAULT, &lv_font_simsun_12);
lv_style_set_text_letter_space(&style_screen_gauge_speed_main, LV_STATE_DEFAULT, 0);
lv_style_set_pad_inner(&style_screen_gauge_speed_main, LV_STATE_DEFAULT, 15);
lv_style_set_line_color(&style_screen_gauge_speed_main, LV_STATE_DEFAULT, lv_color_make(0x8b, 0x89, 0x8b));
lv_style_set_line_width(&style_screen_gauge_speed_main, LV_STATE_DEFAULT, 3);
lv_style_set_line_opa(&style_screen_gauge_speed_main, LV_STATE_DEFAULT, 255);
lv_style_set_scale_grad_color(&style_screen_gauge_speed_main, LV_STATE_DEFAULT, lv_color_make(0x8b, 0x89, 0x8b));
lv_style_set_scale_end_color(&style_screen_gauge_speed_main, LV_STATE_DEFAULT, lv_color_make(0x00, 0xa1, 0xb5));
lv_style_set_scale_width(&style_screen_gauge_speed_main, LV_STATE_DEFAULT, 9);
lv_style_set_scale_border_width(&style_screen_gauge_speed_main, LV_STATE_DEFAULT, 0);
lv_style_set_scale_end_border_width(&style_screen_gauge_speed_main, LV_STATE_DEFAULT, 5);
lv_style_set_scale_end_line_width(&style_screen_gauge_speed_main, LV_STATE_DEFAULT, 4);
lv_obj_add_style(ui->screen_gauge_speed, LV_GAUGE_PART_MAIN, &style_screen_gauge_speed_main);
//Write style LV_GAUGE_PART_MAJOR for screen_gauge_speed
static lv_style_t style_screen_gauge_speed_major;
lv_style_reset(&style_screen_gauge_speed_major);
//Write style state: LV_STATE_DEFAULT for style_screen_gauge_speed_major
lv_style_set_line_color(&style_screen_gauge_speed_major, LV_STATE_DEFAULT, lv_color_make(0x8b, 0x89, 0x8b));
lv_style_set_line_width(&style_screen_gauge_speed_major, LV_STATE_DEFAULT, 5);
lv_style_set_line_opa(&style_screen_gauge_speed_major, LV_STATE_DEFAULT, 255);
lv_style_set_scale_grad_color(&style_screen_gauge_speed_major, LV_STATE_DEFAULT, lv_color_make(0x8b, 0x89, 0x8b));
lv_style_set_scale_end_color(&style_screen_gauge_speed_major, LV_STATE_DEFAULT, lv_color_make(0x00, 0xa1, 0xb5));
lv_style_set_scale_width(&style_screen_gauge_speed_major, LV_STATE_DEFAULT, 16);
lv_style_set_scale_end_line_width(&style_screen_gauge_speed_major, LV_STATE_DEFAULT, 5);
lv_obj_add_style(ui->screen_gauge_speed, LV_GAUGE_PART_MAJOR, &style_screen_gauge_speed_major);
//Write style LV_GAUGE_PART_NEEDLE for screen_gauge_speed
static lv_style_t style_screen_gauge_speed_needle;
lv_style_reset(&style_screen_gauge_speed_needle);
//Write style state: LV_STATE_DEFAULT for style_screen_gauge_speed_needle
lv_style_set_size(&style_screen_gauge_speed_needle, LV_STATE_DEFAULT, 21);
lv_style_set_bg_color(&style_screen_gauge_speed_needle, LV_STATE_DEFAULT, lv_color_make(0x41, 0x48, 0x5a));
lv_style_set_bg_grad_color(&style_screen_gauge_speed_needle, LV_STATE_DEFAULT, lv_color_make(0x41, 0x48, 0x5a));
lv_style_set_bg_grad_dir(&style_screen_gauge_speed_needle, LV_STATE_DEFAULT, LV_GRAD_DIR_VER);
lv_style_set_bg_opa(&style_screen_gauge_speed_needle, LV_STATE_DEFAULT, 255);
lv_style_set_pad_inner(&style_screen_gauge_speed_needle, LV_STATE_DEFAULT, 0);
lv_style_set_line_width(&style_screen_gauge_speed_needle, LV_STATE_DEFAULT, 4);
lv_style_set_line_opa(&style_screen_gauge_speed_needle, LV_STATE_DEFAULT, 255);
lv_obj_add_style(ui->screen_gauge_speed, LV_GAUGE_PART_NEEDLE, &style_screen_gauge_speed_needle);
lv_obj_set_pos(ui->screen_gauge_speed, 600, 62);
lv_obj_set_size(ui->screen_gauge_speed, 182, 182);
lv_gauge_set_scale(ui->screen_gauge_speed, 300, 25, 13);
lv_gauge_set_range(ui->screen_gauge_speed, 0, 120);
static lv_color_t needle_colors_screen_gauge_speed[1];
needle_colors_screen_gauge_speed[0] = lv_color_make(0xff, 0x00, 0x00);
lv_gauge_set_needle_count(ui->screen_gauge_speed, 1, needle_colors_screen_gauge_speed);
lv_gauge_set_critical_value(ui->screen_gauge_speed, 80);
lv_gauge_set_value(ui->screen_gauge_speed, 0, 0);
//Write codes screen_label_humi
ui->screen_label_humi = lv_label_create(ui->screen, NULL);
lv_label_set_text(ui->screen_label_humi, "湿度");
lv_label_set_long_mode(ui->screen_label_humi, LV_LABEL_LONG_BREAK);
lv_label_set_align(ui->screen_label_humi, LV_LABEL_ALIGN_CENTER);
//Write style LV_LABEL_PART_MAIN for screen_label_humi
static lv_style_t style_screen_label_humi_main;
lv_style_reset(&style_screen_label_humi_main);
//Write style state: LV_STATE_DEFAULT for style_screen_label_humi_main
lv_style_set_radius(&style_screen_label_humi_main, LV_STATE_DEFAULT, 0);
lv_style_set_bg_color(&style_screen_label_humi_main, LV_STATE_DEFAULT, lv_color_make(0xff, 0xff, 0xff));
lv_style_set_bg_grad_color(&style_screen_label_humi_main, LV_STATE_DEFAULT, lv_color_make(0xff, 0xff, 0xff));
lv_style_set_bg_grad_dir(&style_screen_label_humi_main, LV_STATE_DEFAULT, LV_GRAD_DIR_VER);
lv_style_set_bg_opa(&style_screen_label_humi_main, LV_STATE_DEFAULT, 255);
lv_style_set_text_color(&style_screen_label_humi_main, LV_STATE_DEFAULT, lv_color_make(0x00, 0x00, 0x00));
lv_style_set_text_font(&style_screen_label_humi_main, LV_STATE_DEFAULT, &lv_font_simsun_20);
lv_style_set_text_letter_space(&style_screen_label_humi_main, LV_STATE_DEFAULT, 2);
lv_style_set_pad_left(&style_screen_label_humi_main, LV_STATE_DEFAULT, 0);
lv_style_set_pad_right(&style_screen_label_humi_main, LV_STATE_DEFAULT, 0);
lv_style_set_pad_top(&style_screen_label_humi_main, LV_STATE_DEFAULT, 0);
lv_style_set_pad_bottom(&style_screen_label_humi_main, LV_STATE_DEFAULT, 0);
lv_obj_add_style(ui->screen_label_humi, LV_LABEL_PART_MAIN, &style_screen_label_humi_main);
lv_obj_set_pos(ui->screen_label_humi, 236, 280);
lv_obj_set_size(ui->screen_label_humi, 100, 0);
//Write codes screen_label_press
ui->screen_label_press = lv_label_create(ui->screen, NULL);
lv_label_set_text(ui->screen_label_press, "压力");
lv_label_set_long_mode(ui->screen_label_press, LV_LABEL_LONG_BREAK);
lv_label_set_align(ui->screen_label_press, LV_LABEL_ALIGN_CENTER);
//Write style LV_LABEL_PART_MAIN for screen_label_press
static lv_style_t style_screen_label_press_main;
lv_style_reset(&style_screen_label_press_main);
//Write style state: LV_STATE_DEFAULT for style_screen_label_press_main
lv_style_set_radius(&style_screen_label_press_main, LV_STATE_DEFAULT, 0);
lv_style_set_bg_color(&style_screen_label_press_main, LV_STATE_DEFAULT, lv_color_make(0xff, 0xff, 0xff));
lv_style_set_bg_grad_color(&style_screen_label_press_main, LV_STATE_DEFAULT, lv_color_make(0xff, 0xff, 0xff));
lv_style_set_bg_grad_dir(&style_screen_label_press_main, LV_STATE_DEFAULT, LV_GRAD_DIR_VER);
lv_style_set_bg_opa(&style_screen_label_press_main, LV_STATE_DEFAULT, 255);
lv_style_set_text_color(&style_screen_label_press_main, LV_STATE_DEFAULT, lv_color_make(0x00, 0x00, 0x00));
lv_style_set_text_font(&style_screen_label_press_main, LV_STATE_DEFAULT, &lv_font_simsun_20);
lv_style_set_text_letter_space(&style_screen_label_press_main, LV_STATE_DEFAULT, 2);
lv_style_set_pad_left(&style_screen_label_press_main, LV_STATE_DEFAULT, 0);
lv_style_set_pad_right(&style_screen_label_press_main, LV_STATE_DEFAULT, 0);
lv_style_set_pad_top(&style_screen_label_press_main, LV_STATE_DEFAULT, 0);
lv_style_set_pad_bottom(&style_screen_label_press_main, LV_STATE_DEFAULT, 0);
lv_obj_add_style(ui->screen_label_press, LV_LABEL_PART_MAIN, &style_screen_label_press_main);
lv_obj_set_pos(ui->screen_label_press, 433, 280);
lv_obj_set_size(ui->screen_label_press, 100, 0);
//Write codes screen_label_speed
ui->screen_label_speed = lv_label_create(ui->screen, NULL);
lv_label_set_text(ui->screen_label_speed, "速度");
lv_label_set_long_mode(ui->screen_label_speed, LV_LABEL_LONG_BREAK);
lv_label_set_align(ui->screen_label_speed, LV_LABEL_ALIGN_CENTER);
//Write style LV_LABEL_PART_MAIN for screen_label_speed
static lv_style_t style_screen_label_speed_main;
lv_style_reset(&style_screen_label_speed_main);
//Write style state: LV_STATE_DEFAULT for style_screen_label_speed_main
lv_style_set_radius(&style_screen_label_speed_main, LV_STATE_DEFAULT, 0);
lv_style_set_bg_color(&style_screen_label_speed_main, LV_STATE_DEFAULT, lv_color_make(0xff, 0xff, 0xff));
lv_style_set_bg_grad_color(&style_screen_label_speed_main, LV_STATE_DEFAULT, lv_color_make(0xff, 0xff, 0xff));
lv_style_set_bg_grad_dir(&style_screen_label_speed_main, LV_STATE_DEFAULT, LV_GRAD_DIR_VER);
lv_style_set_bg_opa(&style_screen_label_speed_main, LV_STATE_DEFAULT, 255);
lv_style_set_text_color(&style_screen_label_speed_main, LV_STATE_DEFAULT, lv_color_make(0x00, 0x00, 0x00));
lv_style_set_text_font(&style_screen_label_speed_main, LV_STATE_DEFAULT, &lv_font_simsun_20);
lv_style_set_text_letter_space(&style_screen_label_speed_main, LV_STATE_DEFAULT, 2);
lv_style_set_pad_left(&style_screen_label_speed_main, LV_STATE_DEFAULT, 0);
lv_style_set_pad_right(&style_screen_label_speed_main, LV_STATE_DEFAULT, 0);
lv_style_set_pad_top(&style_screen_label_speed_main, LV_STATE_DEFAULT, 0);
lv_style_set_pad_bottom(&style_screen_label_speed_main, LV_STATE_DEFAULT, 0);
lv_obj_add_style(ui->screen_label_speed, LV_LABEL_PART_MAIN, &style_screen_label_speed_main);
lv_obj_set_pos(ui->screen_label_speed, 640, 284);
lv_obj_set_size(ui->screen_label_speed, 100, 0);
//Write codes screen_label_long
ui->screen_label_long = lv_label_create(ui->screen, NULL);
lv_label_set_text(ui->screen_label_long, "经度:");
lv_label_set_long_mode(ui->screen_label_long, LV_LABEL_LONG_BREAK);
lv_label_set_align(ui->screen_label_long, LV_LABEL_ALIGN_CENTER);
//Write style LV_LABEL_PART_MAIN for screen_label_long
static lv_style_t style_screen_label_long_main;
lv_style_reset(&style_screen_label_long_main);
//Write style state: LV_STATE_DEFAULT for style_screen_label_long_main
lv_style_set_radius(&style_screen_label_long_main, LV_STATE_DEFAULT, 0);
lv_style_set_bg_color(&style_screen_label_long_main, LV_STATE_DEFAULT, lv_color_make(0xff, 0xff, 0xff));
lv_style_set_bg_grad_color(&style_screen_label_long_main, LV_STATE_DEFAULT, lv_color_make(0xff, 0xff, 0xff));
lv_style_set_bg_grad_dir(&style_screen_label_long_main, LV_STATE_DEFAULT, LV_GRAD_DIR_VER);
lv_style_set_bg_opa(&style_screen_label_long_main, LV_STATE_DEFAULT, 255);
lv_style_set_text_color(&style_screen_label_long_main, LV_STATE_DEFAULT, lv_color_make(0x00, 0x00, 0x00));
lv_style_set_text_font(&style_screen_label_long_main, LV_STATE_DEFAULT, &lv_font_simsun_20);
lv_style_set_text_letter_space(&style_screen_label_long_main, LV_STATE_DEFAULT, 2);
lv_style_set_pad_left(&style_screen_label_long_main, LV_STATE_DEFAULT, 0);
lv_style_set_pad_right(&style_screen_label_long_main, LV_STATE_DEFAULT, 0);
lv_style_set_pad_top(&style_screen_label_long_main, LV_STATE_DEFAULT, 0);
lv_style_set_pad_bottom(&style_screen_label_long_main, LV_STATE_DEFAULT, 0);
lv_obj_add_style(ui->screen_label_long, LV_LABEL_PART_MAIN, &style_screen_label_long_main);
lv_obj_set_pos(ui->screen_label_long, 43, 425);
lv_obj_set_size(ui->screen_label_long, 100, 0);
//Write codes screen_label_lat
ui->screen_label_lat = lv_label_create(ui->screen, NULL);
lv_label_set_text(ui->screen_label_lat, "纬度:");
lv_label_set_long_mode(ui->screen_label_lat, LV_LABEL_LONG_BREAK);
lv_label_set_align(ui->screen_label_lat, LV_LABEL_ALIGN_CENTER);
//Write style LV_LABEL_PART_MAIN for screen_label_lat
static lv_style_t style_screen_label_lat_main;
lv_style_reset(&style_screen_label_lat_main);
//Write style state: LV_STATE_DEFAULT for style_screen_label_lat_main
lv_style_set_radius(&style_screen_label_lat_main, LV_STATE_DEFAULT, 0);
lv_style_set_bg_color(&style_screen_label_lat_main, LV_STATE_DEFAULT, lv_color_make(0xff, 0xff, 0xff));
lv_style_set_bg_grad_color(&style_screen_label_lat_main, LV_STATE_DEFAULT, lv_color_make(0xff, 0xff, 0xff));
lv_style_set_bg_grad_dir(&style_screen_label_lat_main, LV_STATE_DEFAULT, LV_GRAD_DIR_VER);
lv_style_set_bg_opa(&style_screen_label_lat_main, LV_STATE_DEFAULT, 255);
lv_style_set_text_color(&style_screen_label_lat_main, LV_STATE_DEFAULT, lv_color_make(0x00, 0x00, 0x00));
lv_style_set_text_font(&style_screen_label_lat_main, LV_STATE_DEFAULT, &lv_font_simsun_20);
lv_style_set_text_letter_space(&style_screen_label_lat_main, LV_STATE_DEFAULT, 2);
lv_style_set_pad_left(&style_screen_label_lat_main, LV_STATE_DEFAULT, 0);
lv_style_set_pad_right(&style_screen_label_lat_main, LV_STATE_DEFAULT, 0);
lv_style_set_pad_top(&style_screen_label_lat_main, LV_STATE_DEFAULT, 0);
lv_style_set_pad_bottom(&style_screen_label_lat_main, LV_STATE_DEFAULT, 0);
lv_obj_add_style(ui->screen_label_lat, LV_LABEL_PART_MAIN, &style_screen_label_lat_main);
lv_obj_set_pos(ui->screen_label_lat, 388, 428);
lv_obj_set_size(ui->screen_label_lat, 100, 0);
//Write codes screen_label_long_value
ui->screen_label_long_value = lv_label_create(ui->screen, NULL);
lv_label_set_text(ui->screen_label_long_value, "0");
lv_label_set_long_mode(ui->screen_label_long_value, LV_LABEL_LONG_BREAK);
lv_label_set_align(ui->screen_label_long_value, LV_LABEL_ALIGN_CENTER);
//Write style LV_LABEL_PART_MAIN for screen_label_long_value
static lv_style_t style_screen_label_long_value_main;
lv_style_reset(&style_screen_label_long_value_main);
//Write style state: LV_STATE_DEFAULT for style_screen_label_long_value_main
lv_style_set_radius(&style_screen_label_long_value_main, LV_STATE_DEFAULT, 0);
lv_style_set_bg_color(&style_screen_label_long_value_main, LV_STATE_DEFAULT, lv_color_make(0xff, 0xff, 0xff));
lv_style_set_bg_grad_color(&style_screen_label_long_value_main, LV_STATE_DEFAULT, lv_color_make(0xff, 0xff, 0xff));
lv_style_set_bg_grad_dir(&style_screen_label_long_value_main, LV_STATE_DEFAULT, LV_GRAD_DIR_VER);
lv_style_set_bg_opa(&style_screen_label_long_value_main, LV_STATE_DEFAULT, 255);
lv_style_set_text_color(&style_screen_label_long_value_main, LV_STATE_DEFAULT, lv_color_make(0x00, 0x00, 0x00));
lv_style_set_text_font(&style_screen_label_long_value_main, LV_STATE_DEFAULT, &lv_font_simsun_20);
lv_style_set_text_letter_space(&style_screen_label_long_value_main, LV_STATE_DEFAULT, 2);
lv_style_set_pad_left(&style_screen_label_long_value_main, LV_STATE_DEFAULT, 0);
lv_style_set_pad_right(&style_screen_label_long_value_main, LV_STATE_DEFAULT, 0);
lv_style_set_pad_top(&style_screen_label_long_value_main, LV_STATE_DEFAULT, 0);
lv_style_set_pad_bottom(&style_screen_label_long_value_main, LV_STATE_DEFAULT, 0);
lv_obj_add_style(ui->screen_label_long_value, LV_LABEL_PART_MAIN, &style_screen_label_long_value_main);
lv_obj_set_pos(ui->screen_label_long_value, 200, 426);
lv_obj_set_size(ui->screen_label_long_value, 159, 0);
//Write codes screen_label_lat_value
ui->screen_label_lat_value = lv_label_create(ui->screen, NULL);
lv_label_set_text(ui->screen_label_lat_value, "0");
lv_label_set_long_mode(ui->screen_label_lat_value, LV_LABEL_LONG_BREAK);
lv_label_set_align(ui->screen_label_lat_value, LV_LABEL_ALIGN_CENTER);
//Write style LV_LABEL_PART_MAIN for screen_label_lat_value
static lv_style_t style_screen_label_lat_value_main;
lv_style_reset(&style_screen_label_lat_value_main);
//Write style state: LV_STATE_DEFAULT for style_screen_label_lat_value_main
lv_style_set_radius(&style_screen_label_lat_value_main, LV_STATE_DEFAULT, 0);
lv_style_set_bg_color(&style_screen_label_lat_value_main, LV_STATE_DEFAULT, lv_color_make(0xff, 0xff, 0xff));
lv_style_set_bg_grad_color(&style_screen_label_lat_value_main, LV_STATE_DEFAULT, lv_color_make(0xff, 0xff, 0xff));
lv_style_set_bg_grad_dir(&style_screen_label_lat_value_main, LV_STATE_DEFAULT, LV_GRAD_DIR_VER);
lv_style_set_bg_opa(&style_screen_label_lat_value_main, LV_STATE_DEFAULT, 255);
lv_style_set_text_color(&style_screen_label_lat_value_main, LV_STATE_DEFAULT, lv_color_make(0x00, 0x00, 0x00));
lv_style_set_text_font(&style_screen_label_lat_value_main, LV_STATE_DEFAULT, &lv_font_simsun_20);
lv_style_set_text_letter_space(&style_screen_label_lat_value_main, LV_STATE_DEFAULT, 2);
lv_style_set_pad_left(&style_screen_label_lat_value_main, LV_STATE_DEFAULT, 0);
lv_style_set_pad_right(&style_screen_label_lat_value_main, LV_STATE_DEFAULT, 0);
lv_style_set_pad_top(&style_screen_label_lat_value_main, LV_STATE_DEFAULT, 0);
lv_style_set_pad_bottom(&style_screen_label_lat_value_main, LV_STATE_DEFAULT, 0);
lv_obj_add_style(ui->screen_label_lat_value, LV_LABEL_PART_MAIN, &style_screen_label_lat_value_main);
lv_obj_set_pos(ui->screen_label_lat_value, 528, 428);
lv_obj_set_size(ui->screen_label_lat_value, 159, 0);
//Write codes screen_label_temp_value
ui->screen_label_temp_value = lv_label_create(ui->screen, NULL);
lv_label_set_text(ui->screen_label_temp_value, "0C");
lv_label_set_long_mode(ui->screen_label_temp_value, LV_LABEL_LONG_BREAK);
lv_label_set_align(ui->screen_label_temp_value, LV_LABEL_ALIGN_CENTER);
//Write style LV_LABEL_PART_MAIN for screen_label_temp_value
static lv_style_t style_screen_label_temp_value_main;
lv_style_reset(&style_screen_label_temp_value_main);
//Write style state: LV_STATE_DEFAULT for style_screen_label_temp_value_main
lv_style_set_radius(&style_screen_label_temp_value_main, LV_STATE_DEFAULT, 0);
lv_style_set_bg_color(&style_screen_label_temp_value_main, LV_STATE_DEFAULT, lv_color_make(0xff, 0xff, 0xff));
lv_style_set_bg_grad_color(&style_screen_label_temp_value_main, LV_STATE_DEFAULT, lv_color_make(0xff, 0xff, 0xff));
lv_style_set_bg_grad_dir(&style_screen_label_temp_value_main, LV_STATE_DEFAULT, LV_GRAD_DIR_VER);
lv_style_set_bg_opa(&style_screen_label_temp_value_main, LV_STATE_DEFAULT, 255);
lv_style_set_text_color(&style_screen_label_temp_value_main, LV_STATE_DEFAULT, lv_color_make(0x00, 0x00, 0x00));
lv_style_set_text_font(&style_screen_label_temp_value_main, LV_STATE_DEFAULT, &lv_font_simsun_20);
lv_style_set_text_letter_space(&style_screen_label_temp_value_main, LV_STATE_DEFAULT, 2);
lv_style_set_pad_left(&style_screen_label_temp_value_main, LV_STATE_DEFAULT, 0);
lv_style_set_pad_right(&style_screen_label_temp_value_main, LV_STATE_DEFAULT, 0);
lv_style_set_pad_top(&style_screen_label_temp_value_main, LV_STATE_DEFAULT, 0);
lv_style_set_pad_bottom(&style_screen_label_temp_value_main, LV_STATE_DEFAULT, 0);
lv_obj_add_style(ui->screen_label_temp_value, LV_LABEL_PART_MAIN, &style_screen_label_temp_value_main);
lv_obj_set_pos(ui->screen_label_temp_value, 25, 319);
lv_obj_set_size(ui->screen_label_temp_value, 145, 0);
//Write codes screen_label_humi_value
ui->screen_label_humi_value = lv_label_create(ui->screen, NULL);
lv_label_set_text(ui->screen_label_humi_value, "0%");
lv_label_set_long_mode(ui->screen_label_humi_value, LV_LABEL_LONG_BREAK);
lv_label_set_align(ui->screen_label_humi_value, LV_LABEL_ALIGN_CENTER);
//Write style LV_LABEL_PART_MAIN for screen_label_humi_value
static lv_style_t style_screen_label_humi_value_main;
lv_style_reset(&style_screen_label_humi_value_main);
//Write style state: LV_STATE_DEFAULT for style_screen_label_humi_value_main
lv_style_set_radius(&style_screen_label_humi_value_main, LV_STATE_DEFAULT, 0);
lv_style_set_bg_color(&style_screen_label_humi_value_main, LV_STATE_DEFAULT, lv_color_make(0xff, 0xff, 0xff));
lv_style_set_bg_grad_color(&style_screen_label_humi_value_main, LV_STATE_DEFAULT, lv_color_make(0xff, 0xff, 0xff));
lv_style_set_bg_grad_dir(&style_screen_label_humi_value_main, LV_STATE_DEFAULT, LV_GRAD_DIR_VER);
lv_style_set_bg_opa(&style_screen_label_humi_value_main, LV_STATE_DEFAULT, 255);
lv_style_set_text_color(&style_screen_label_humi_value_main, LV_STATE_DEFAULT, lv_color_make(0x00, 0x00, 0x00));
lv_style_set_text_font(&style_screen_label_humi_value_main, LV_STATE_DEFAULT, &lv_font_simsun_20);
lv_style_set_text_letter_space(&style_screen_label_humi_value_main, LV_STATE_DEFAULT, 2);
lv_style_set_pad_left(&style_screen_label_humi_value_main, LV_STATE_DEFAULT, 0);
lv_style_set_pad_right(&style_screen_label_humi_value_main, LV_STATE_DEFAULT, 0);
lv_style_set_pad_top(&style_screen_label_humi_value_main, LV_STATE_DEFAULT, 0);
lv_style_set_pad_bottom(&style_screen_label_humi_value_main, LV_STATE_DEFAULT, 0);
lv_obj_add_style(ui->screen_label_humi_value, LV_LABEL_PART_MAIN, &style_screen_label_humi_value_main);
lv_obj_set_pos(ui->screen_label_humi_value, 221, 323);
lv_obj_set_size(ui->screen_label_humi_value, 145, 0);
//Write codes screen_label_press_value
ui->screen_label_press_value = lv_label_create(ui->screen, NULL);
lv_label_set_text(ui->screen_label_press_value, "0pa");
lv_label_set_long_mode(ui->screen_label_press_value, LV_LABEL_LONG_BREAK);
lv_label_set_align(ui->screen_label_press_value, LV_LABEL_ALIGN_CENTER);
//Write style LV_LABEL_PART_MAIN for screen_label_press_value
static lv_style_t style_screen_label_press_value_main;
lv_style_reset(&style_screen_label_press_value_main);
//删除部分代码,文章超字数
}
extern lv_ui guider_ui;
void set_label_temp_value(uint16_t value)
{
lv_label_set_text_fmt(guider_ui.screen_label_temp_value, "%d.%d C",value/10,value);
lv_gauge_set_value(guider_ui.screen_gauge_temp, 0 ,value/10);
}
void set_label_humi_value(uint16_t value)
{
lv_label_set_text_fmt(guider_ui.screen_label_humi_value, "%d.%d %%",value/10,value);
lv_gauge_set_value(guider_ui.screen_gauge_humi, 0,value/10);
}
void set_label_press_value(uint16_t value)
{
lv_label_set_text_fmt(guider_ui.screen_label_press_value, "%d pa",value);
lv_gauge_set_value(guider_ui.screen_gauge_press, 0,value/10);
}
void set_label_speed_value(uint16_t value)
{
lv_label_set_text_fmt(guider_ui.screen_label_speed_value, "%d.%d Km/h",value/10,value);
lv_gauge_set_value(guider_ui.screen_gauge_speed, 0,value/10);
}
void set_label_lat_value(char *value)
{
lv_label_set_text(guider_ui.screen_label_lat_value,value);
}
void set_label_long_value(char *value)
{
lv_label_set_text(guider_ui.screen_label_long_value,value);
}
这是最重要的一个文件了。他是任务的显示,同时对几个label进行修改的函数。
四.硬件整体
五.腾讯连连界面功能
这是我在腾讯云平台上创建的,可以用来调试,信息,同时上一步中可以生成腾讯连连的面板,和APP,这些就可以自己二次开发的。
这里我还是使用最原始的,没有改动的面板。
六.总结
本次的TencentOS Tiny AIoT应用创新大赛,让我接触到了TencentOS Tiny系统,学习这款系统,暂时还未从移植开始,因为本次官方所给的移植案例也是很丰富的,自己基本只需要修改下基本就能使用起来,但从其修改的代码上看,学习起来应该也很容易,后期希望通过自己移植到别的板子来继续学习。本次大赛提供的硬件也是很强大的,基本把MCU能做到的都弄好的,也看到了许多人移植图像处理,声音处理的算法还是很厉害的,希望后期基于这样一个平台接着深入的学习这款开发板。
七.参赛信息(署名)
席**
152****5840