smart-greenhouse/submenu.cpp
2022-01-20 18:06:11 +08:00

93 lines
2.5 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include "submenu.h"
#include "ui_submenu.h"
submenu::submenu(QWidget *parent) :
QWidget(parent),
ui(new Ui::submenu)
{
ui->setupUi(this);
this->setWindowIcon(QIcon(":/ico.png"));
this->setWindowTitle("风中有朵雨做的云");
/* 喷头状态 灯状态 风扇状态 温度值,湿度值,光照--勒克斯(Lux或Lx),被光均匀照射的物体,在1平方米面积上所得的光通量是1流明时,它的照度是1勒克斯
fan 风扇 opf打开风扇 off关闭风扇
led1 灯1 opl1打开灯1 ofl1关闭灯1
led2 灯2 opl2打开灯2 ofl2 关闭灯2
buzzer蜂鸣器 temp温度超过阈值 hum湿度超过阈值 light光照超过阈值 smoke烟雾浓度超过阈值
rfid模块
A9发命令到m0
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
tag Id len date crc
对齐 fan led1 led2 buzzer rfid 对齐
opf off opl1 ofl1 opl2 ofl2 temp hum light smoke
dd 4 24 4 1 0 1 0 1 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
表 2
环境数据包
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
tag id len date crc
对齐 tem hum adc light smoke state rfid 对齐
1 h 1 h ch0 ch1 led fan buzz led2
bb 4 24 4 0 20 0 23 1f 0 0 0 23 0 0 0 70 0 0 0 80 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0
*/
ui->stackedWidget->setCurrentWidget(ui->lightPage);
ui->lightBtn->setEnabled(false);
}
submenu::~submenu()
{
delete ui;
}
void submenu::on_quitBtn_clicked()
{
this->hide();
emit widget_close();
this->close();
}
void submenu::on_lightBtn_clicked()
{
ui->stackedWidget->setCurrentWidget(ui->lightPage);
//按下灯光按钮后让灯光按钮变成不可选状态,喷淋和风扇按钮变为可选状态
ui->lightBtn->setEnabled(false);
ui->sprayBtn->setEnabled(true);
ui->fanBtn->setEnabled(true);
}
void submenu::on_fanBtn_clicked()
{
ui->stackedWidget->setCurrentWidget(ui->fanPage);
//按下空调按钮后让风扇按钮变成不可选状态,灯光按钮和喷淋按钮变为可选状态
ui->fanBtn->setEnabled(false);
ui->lightBtn->setEnabled(true);
ui->sprayBtn->setEnabled(true);
}
void submenu::on_sprayBtn_clicked()
{
ui->stackedWidget->setCurrentWidget(ui->sprayPage);
//按下空调按钮后让喷淋按钮变成不可选状态,灯光按钮和风扇按钮变为可选状态
ui->fanBtn->setEnabled(true);
ui->lightBtn->setEnabled(true);
ui->sprayBtn->setEnabled(false);
}