Merge branch 'master' of 192.168.1.250:/home/git/AHome into master
This commit is contained in:
@@ -24,7 +24,7 @@ void setup() {
|
||||
analogReference(INTERNAL);
|
||||
sensorValue = analogRead(BATTERY_SENSE_PIN);
|
||||
v = sensorValue * 0.004659498;
|
||||
batteryPcnt = (v * 100) / 4.2;
|
||||
batteryPcnt = (v-3.0 * 100) / 1.2;
|
||||
while (myAHT10.begin() != true)
|
||||
{
|
||||
Serial.println(F("AHT10 not connected or fail to load calibration coefficient")); //(F()) save string to flash & keeps dynamic memory free
|
||||
@@ -53,7 +53,7 @@ void loop() {
|
||||
send(msgMillis.set(cRun));
|
||||
sensorValue = analogRead(BATTERY_SENSE_PIN);
|
||||
v = sensorValue * 0.004659498;
|
||||
batteryPcnt = (v-3 * 100) / 1.2;
|
||||
batteryPcnt = ((v-3.0) * 100) / 1.2;
|
||||
sendBatteryLevel(batteryPcnt);
|
||||
send(msgVolts.set(v, 2));
|
||||
//}
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
|
||||
#define TOP_LOCK A0
|
||||
#define INT_LOCK A1
|
||||
#define DOWN_LOCK A2
|
||||
#define SMALL_LOCK A3
|
||||
#define DOWN_LOCK A3
|
||||
#define SMALL_LOCK A2
|
||||
#define DOOR A4
|
||||
|
||||
#define TOP_LOCK_ID 0
|
||||
@@ -58,47 +58,56 @@ void presentation()
|
||||
present(SMALL_LOCK_ID, S_LOCK, "Small");
|
||||
present(DOOR_ID, S_LOCK, "Door");
|
||||
present(CUSTOM_ID, S_CUSTOM);
|
||||
sendData(msgDoor, digitalRead(DOOR));
|
||||
wait(100);
|
||||
sendData(msgTop, digitalRead(TOP_LOCK));
|
||||
wait(100);
|
||||
sendData(msgInt, digitalRead(INT_LOCK));
|
||||
wait(100);
|
||||
sendData(msgDown, digitalRead(DOWN_LOCK));
|
||||
wait(100);
|
||||
sendData(msgSmall, digitalRead(SMALL_LOCK));
|
||||
}
|
||||
|
||||
void setup() {
|
||||
// put your setup code here, to run once:
|
||||
bpDoor = !digitalRead(DOOR);
|
||||
bpTop = !digitalRead(TOP_LOCK);
|
||||
bpInt = !digitalRead(INT_LOCK);
|
||||
bpSmall = !digitalRead(SMALL_LOCK);
|
||||
bpDown = !digitalRead(DOWN_LOCK);
|
||||
sendData(msgDoor, bpDoor);
|
||||
wait(100);
|
||||
sendData(msgTop, bpTop);
|
||||
wait(100);
|
||||
sendData(msgInt, bpInt);
|
||||
wait(100);
|
||||
sendData(msgDown, bpDown);
|
||||
wait(100);
|
||||
sendData(msgSmall, bpSmall);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
static uint32_t cRun = millis();
|
||||
bool bTop, bInt, bDown, bSmall, bDoor;
|
||||
bTop = digitalRead(TOP_LOCK);
|
||||
bInt = digitalRead(INT_LOCK);
|
||||
bDown = digitalRead(DOWN_LOCK);
|
||||
bSmall = digitalRead(SMALL_LOCK);
|
||||
bDoor = digitalRead(DOOR);
|
||||
bTop = !digitalRead(TOP_LOCK);
|
||||
bInt = !digitalRead(INT_LOCK);
|
||||
bDown = !digitalRead(DOWN_LOCK);
|
||||
bSmall = !digitalRead(SMALL_LOCK);
|
||||
bDoor = !digitalRead(DOOR);
|
||||
if(bTop != bpTop){
|
||||
bpTop = bTop;
|
||||
sendData(msgTop, bDoor);
|
||||
Serial.print(F("Top Lock-"));Serial.println(bTop);
|
||||
sendData(msgTop, bTop);
|
||||
}
|
||||
if(bInt != bpInt){
|
||||
bpInt = bInt;
|
||||
Serial.print(F("Int Lock-"));Serial.println(bInt);
|
||||
sendData(msgInt, bInt);
|
||||
}
|
||||
if(bDown != bpDown){
|
||||
bpDown = bDown;
|
||||
Serial.print(F("Down Lock-"));Serial.println(bDown);
|
||||
sendData(msgDown, bDown);
|
||||
}
|
||||
if(bSmall != bpSmall){
|
||||
bpSmall = bSmall;
|
||||
Serial.print(F("Small Lock-"));Serial.println(bSmall);
|
||||
sendData(msgSmall, bSmall);
|
||||
}
|
||||
if(bDoor != bpDoor){
|
||||
bpDoor = bDoor;
|
||||
Serial.print(F("Door-"));Serial.println(bDoor);
|
||||
sendData(msgDoor, bDoor);
|
||||
}
|
||||
if((cRun + 29999) < millis()){
|
||||
|
||||
@@ -16,6 +16,7 @@ monitor_speed = 115200
|
||||
upload_protocol = espota
|
||||
upload_port = 192.168.1.134
|
||||
lib_deps =
|
||||
# RECOMMENDED
|
||||
# Accept new functionality in a backwards compatible manner and patches
|
||||
closedcube/ClosedCube HDC1080 @ ^1.3.2
|
||||
closedcube/ClosedCube HDC1080 @ ^1.3.2
|
||||
mathertel/RotaryEncoder @ ^1.3.0
|
||||
robtillaart/PCF8574 @ ^0.2.1
|
||||
robtillaart/I2C_EEPROM @ ^1.3.0
|
||||
|
||||
@@ -574,8 +574,10 @@ void onMqttConnect(bool sessionPresent) {
|
||||
mqttClient.subscribe("/home/vt/hdb_set", 1);
|
||||
sprintf(v, "%.2f", wCounter.QH);
|
||||
mqttClient.publish("/home/vt/qhot", 1, false, v);
|
||||
mqttClient.publish("/home/vt/qhot_set", 1, false, v);
|
||||
sprintf(v, "%.2f", wCounter.QC);
|
||||
mqttClient.publish("/home/vt/qcold", 1, false, v);
|
||||
mqttClient.publish("/home/vt/qcold_set", 1, false, v);
|
||||
itoa(wUstavki.hDB, v, 10);
|
||||
mqttClient.publish("/home/vt/hdb", 1, false, v);
|
||||
itoa(wUstavki.hSP, v, 10);
|
||||
@@ -653,8 +655,13 @@ void onMqttMessage(char* topic, char* payload, AsyncMqttClientMessageProperties
|
||||
ee.writeBlock(8, (uint8_t*)&wUstavki, sizeof(wCounter));
|
||||
itoa(wUstavki.hDB, v, 10);
|
||||
mqttClient.publish("/home/vt/hdb", 1, false, v);
|
||||
} else
|
||||
if(strcmp(topic, "/home/vt/flood") == 0){
|
||||
pcf.write(LED_RED, !atoi(payload));
|
||||
c_flood = atoi(payload);
|
||||
}
|
||||
}
|
||||
|
||||
void onMqttPublish(uint16_t packetId) {
|
||||
//Serial1.println("Publish acknowledged.");
|
||||
//Serial1.print(" packetId: ");
|
||||
|
||||
Reference in New Issue
Block a user