Added BOX Balkon, LightTBL D1-Mini

This commit is contained in:
2025-01-18 16:43:46 +03:00
parent a84b1f5ef1
commit 12312977df
6 changed files with 147 additions and 67 deletions

View File

@@ -7,6 +7,7 @@
#include <WebSerial.h>
#include <ESP_EEPROM.h>
#include <PubSubClient.h>
#include "OneButton.h"
#include <SPI.h>
//#include "LedController.hpp"
@@ -19,7 +20,12 @@ Disp7219<1> disp(DIO_PIN, CLK_PIN, LAT_PIN);
#include <OneWire.h>
#include <DallasTemperature.h>
#include <PID_v1.h>
//#include <PID_v1.h>
#include "GyverPID.h"
GyverPID regulator;
#include "PWMrelay.h"
#define TRIAC_PIN 15
PWMrelay relay(TRIAC_PIN, true); // реле на 15 пине
#define ONE_WIRE_BUS 2
@@ -30,7 +36,11 @@ Disp7219<1> disp(DIO_PIN, CLK_PIN, LAT_PIN);
#define TOPIC "home/box/"
#define TRIAC_PIN 4
#define PLUS_BUT 16
#define MINUS_BUT 0
OneButton plusBut(PLUS_BUT, true, true);
OneButton minusBut(MINUS_BUT, true, true);
WiFiClient espClient;
PubSubClient client(espClient);
@@ -40,8 +50,6 @@ Ticker wifiReconnectTimer;
AsyncWebServer server(80);
//LedController lc;
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
@@ -50,9 +58,9 @@ float temp_sp, temp1, temp2;
float kp = 0, ki = 0, kd = 0;
double Output = 0, Setpoint = 0, Input = 0;
PID myPID(&Input, &Output, &Setpoint, kp, ki, kd, DIRECT);
unsigned long WindowSize = 5000;
unsigned long windowStartTime;
// PID myPID(&Input, &Output, &Setpoint, kp, ki, kd, DIRECT);
// unsigned long WindowSize = 5000;
// unsigned long windowStartTime;
long lastReconnectAttempt = 0;
@@ -64,4 +72,9 @@ void onWifiConnect(const WiFiEventStationModeGotIP& event);
void onWifiDisconnect(const WiFiEventStationModeDisconnected& event);
void callback(char* topic, byte* payload, unsigned int length);
boolean reconnect();
void out_value(byte digit, float val);
void PlusButPress();
void PlusButLongPress();
void MinusButPress();
void MinusButLongPress();
void display();
void pubData(const char* topic, float val);