code clean
This commit is contained in:
parent
9dae447b17
commit
917450676b
@ -32,6 +32,10 @@ private:
|
||||
public:
|
||||
|
||||
explicit Dallas(int pin) : oneWire(pin), sensors(&oneWire) {
|
||||
// nothing
|
||||
}
|
||||
|
||||
void begin() {
|
||||
sensors.begin();
|
||||
sensors.setWaitForConversion(false);
|
||||
}
|
||||
@ -39,7 +43,7 @@ public:
|
||||
void loop() {
|
||||
if (converting) {
|
||||
if (sensors.isConversionComplete()) {
|
||||
if (first) {
|
||||
if (first || isDebugEnabled()) {
|
||||
first = false;
|
||||
uint8_t count = sensors.getDeviceCount();
|
||||
if (count == 0) {
|
||||
|
||||
@ -10,10 +10,10 @@ monitor_speed = 115200
|
||||
monitor_filters = esp32_exception_decoder
|
||||
WIFI_SSID = HappyNet
|
||||
WIFI_PKEY = 1Grausame!Sackratte7
|
||||
lib_deps = milesburton/DallasTemperature
|
||||
lib_deps = https://github.com/milesburton/Arduino-Temperature-Control-Library
|
||||
knolleary/PubSubClient
|
||||
bblanchon/ArduinoJson
|
||||
paulstoffregen/OneWire
|
||||
Wire
|
||||
https://github.com/phassel/ArduPID/
|
||||
|
||||
[env:TEST32]
|
||||
|
||||
@ -5,12 +5,13 @@
|
||||
#include "config.h"
|
||||
#include <Arduino.h>
|
||||
|
||||
#define CONTROL_GPIO 4
|
||||
#define SENSOR_GPIO D4
|
||||
#define CONTROL_GPIO D2
|
||||
#define CONTROL_PWM_BITS 10
|
||||
|
||||
Dallas dallas(2);
|
||||
Dallas dallas(SENSOR_GPIO);
|
||||
|
||||
DallasSensor sensor(dallas, 0xAA0121125E4A7528, "sensor", 0.5, 5, 60); // TODO wrong address
|
||||
DallasSensor sensor(dallas, 0xAA0121125E4A7528, "sensor", 0.5, 5, 60);
|
||||
|
||||
ArduPID pid;
|
||||
|
||||
@ -29,10 +30,11 @@ double integral = 0;
|
||||
double derivative = 0;
|
||||
|
||||
void patrixSetup() {
|
||||
configLoad();
|
||||
|
||||
dallas.begin();
|
||||
analogWriteResolution(CONTROL_PWM_BITS);
|
||||
|
||||
configLoad();
|
||||
|
||||
pid.begin(&temperatureCurrent, &heaterPWM, &temperatureTarget, proportional, integral, derivative);
|
||||
pid.setOutputLimits(0, pow(10, CONTROL_PWM_BITS) - 1);
|
||||
pid.start();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user