Skip to content

Commit 0ad2f97

Browse files
author
Panagiotis Maragelis
committed
2 parents 63d1910 + f8661f6 commit 0ad2f97

File tree

6 files changed

+191
-2
lines changed

6 files changed

+191
-2
lines changed

.vscode/arduino.json

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
{
2+
<<<<<<< HEAD
23
"board": "esp8266:esp8266:d1_mini_pro",
34
"configuration": "CpuFrequency=80,VTable=flash,FlashSize=16M15M,LwIPVariant=v2mss536,Debug=Disabled,DebugLevel=None____,FlashErase=none,UploadSpeed=921600",
45
"port": "COM8"
6+
=======
7+
"board": "esp32:esp32:esp32",
8+
"configuration": "PSRAM=disabled,PartitionScheme=default,CPUFreq=240,FlashMode=qio,FlashFreq=80,FlashSize=4M,UploadSpeed=921600,DebugLevel=none",
9+
"port": "COM9"
10+
>>>>>>> f8661f6b56d2583029996a5c30fd780bbc9ce5ce
511
}

.vscode/settings.json

+46
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,52 @@
11
{
22
"files.associations": {
33
"*.tpp": "cpp",
4+
<<<<<<< HEAD
45
"random": "cpp"
6+
=======
7+
"system_error": "cpp",
8+
"string": "cpp",
9+
"array": "cpp",
10+
"*.tcc": "cpp",
11+
"bitset": "cpp",
12+
"cctype": "cpp",
13+
"clocale": "cpp",
14+
"cmath": "cpp",
15+
"cstdarg": "cpp",
16+
"cstddef": "cpp",
17+
"cstdint": "cpp",
18+
"cstdio": "cpp",
19+
"cstdlib": "cpp",
20+
"cstring": "cpp",
21+
"ctime": "cpp",
22+
"cwchar": "cpp",
23+
"cwctype": "cpp",
24+
"deque": "cpp",
25+
"unordered_map": "cpp",
26+
"unordered_set": "cpp",
27+
"vector": "cpp",
28+
"exception": "cpp",
29+
"algorithm": "cpp",
30+
"functional": "cpp",
31+
"tuple": "cpp",
32+
"type_traits": "cpp",
33+
"fstream": "cpp",
34+
"initializer_list": "cpp",
35+
"iomanip": "cpp",
36+
"iosfwd": "cpp",
37+
"istream": "cpp",
38+
"limits": "cpp",
39+
"memory": "cpp",
40+
"new": "cpp",
41+
"ostream": "cpp",
42+
"numeric": "cpp",
43+
"sstream": "cpp",
44+
"stdexcept": "cpp",
45+
"streambuf": "cpp",
46+
"cinttypes": "cpp",
47+
"regex": "cpp",
48+
"utility": "cpp",
49+
"typeinfo": "cpp"
50+
>>>>>>> f8661f6b56d2583029996a5c30fd780bbc9ce5ce
551
}
652
}

src/GsmUtilities.h

+121
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
2+
3+
4+
#include <Wire.h>
5+
6+
#if defined(SIM800L_IP5306_VERSION_20190610)
7+
8+
#define MODEM_RST 5
9+
#define MODEM_PWRKEY 4
10+
#define MODEM_POWER_ON 23
11+
#define MODEM_TX 27
12+
#define MODEM_RX 26
13+
14+
#define I2C_SDA 21
15+
#define I2C_SCL 22
16+
#define LED_GPIO 13
17+
#define LED_ON HIGH
18+
#define LED_OFF LOW
19+
20+
#define IP5306_ADDR 0x75
21+
#define IP5306_REG_SYS_CTL0 0x00
22+
23+
// setPowerBoostKeepOn
24+
bool setupPMU()
25+
{
26+
bool en = true;
27+
Wire.beginTransmission(IP5306_ADDR);
28+
Wire.write(IP5306_REG_SYS_CTL0);
29+
if (en) {
30+
Wire.write(0x37); // Set bit1: 1 enable 0 disable boost keep on
31+
} else {
32+
Wire.write(0x35); // 0x37 is default reg value
33+
}
34+
return Wire.endTransmission() == 0;
35+
}
36+
37+
38+
#elif defined(SIM800L_AXP192_VERSION_20200327)
39+
40+
#define MODEM_RST 5
41+
#define MODEM_PWRKEY 4
42+
#define MODEM_POWER_ON 23
43+
#define MODEM_TX 27
44+
#define MODEM_RX 26
45+
#define MODEM_DTR 32
46+
#define MODEM_RI 33
47+
48+
#define I2C_SDA 21
49+
#define I2C_SCL 22
50+
#define LED_GPIO 13
51+
#define LED_ON HIGH
52+
#define LED_OFF LOW
53+
54+
55+
#elif defined(SIM800C_AXP192_VERSION_20200609)
56+
// pin definitions
57+
#define MODEM_PWRKEY 4
58+
#define MODEM_POWER_ON 25
59+
#define MODEM_TX 27
60+
#define MODEM_RX 26
61+
#define MODEM_DTR 32
62+
#define MODEM_RI 33
63+
64+
#define I2C_SDA 21
65+
#define I2C_SCL 22
66+
#define LED_GPIO 12
67+
#define LED_ON LOW
68+
#define LED_OFF HIGH
69+
70+
#else
71+
#error "Please select the corresponding model"
72+
#endif
73+
74+
75+
#if defined(SIM800L_AXP192_VERSION_20200327) || defined(SIM800C_AXP192_VERSION_20200609)
76+
#include <axp20x.h> //https://github.com/lewisxhe/AXP202X_Library
77+
78+
AXP20X_Class axp;
79+
80+
bool setupPMU()
81+
{
82+
// For more information about the use of AXP192, please refer to AXP202X_Library https://github.com/lewisxhe/AXP202X_Library
83+
Wire.begin(I2C_SDA, I2C_SCL);
84+
int ret = axp.begin(Wire, AXP192_SLAVE_ADDRESS);
85+
86+
if (ret == AXP_FAIL) {
87+
Serial.println("AXP Power begin failed");
88+
return false;
89+
}
90+
91+
//! Turn off unused power
92+
axp.setPowerOutPut(AXP192_DCDC1, AXP202_OFF);
93+
axp.setPowerOutPut(AXP192_LDO2, AXP202_OFF);
94+
axp.setPowerOutPut(AXP192_LDO3, AXP202_OFF);
95+
axp.setPowerOutPut(AXP192_DCDC2, AXP202_OFF);
96+
axp.setPowerOutPut(AXP192_EXTEN, AXP202_OFF);
97+
98+
//! Do not turn off DC3, it is powered by esp32
99+
// axp.setPowerOutPut(AXP192_DCDC3, AXP202_ON);
100+
101+
// Set the charging indicator to turn off
102+
// Turn it off to save current consumption
103+
// axp.setChgLEDMode(AXP20X_LED_OFF);
104+
105+
// Set the charging indicator to flash once per second
106+
// axp.setChgLEDMode(AXP20X_LED_BLINK_1HZ);
107+
108+
109+
//! Use axp192 adc get voltage info
110+
axp.adc1Enable(AXP202_VBUS_VOL_ADC1 | AXP202_VBUS_CUR_ADC1 | AXP202_BATT_CUR_ADC1 | AXP202_BATT_VOL_ADC1, true);
111+
112+
float vbus_v = axp.getVbusVoltage();
113+
float vbus_c = axp.getVbusCurrent();
114+
float batt_v = axp.getBattVoltage();
115+
// axp.getBattPercentage(); // axp192 is not support percentage
116+
Serial.printf("VBUS:%.2f mV %.2f mA ,BATTERY: %.2f\n", vbus_v, vbus_c, batt_v);
117+
118+
return true;
119+
}
120+
121+
#endif
File renamed without changes.

src/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1386,7 +1386,7 @@ void setup() {
13861386
serial_flush_buffer();
13871387
configTime(gmtOffset_sec, 0, ntpServer);
13881388
PanelStatus1();
1389-
sendMQTT(root_topicStatus, "{\"status\":\"Program ready\"}" , false);
1389+
sendMQTT(root_topicStatus, "{\"status\":\"Panel Ready\"}" , false);
13901390

13911391
}
13921392

src/main.h

+17-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include <ArduinoJson.h>
77
#include <FS.h>
88
#include <SPIFFS.h>
9+
#include <SPI.h>
910
#include <esp_wifi.h>
1011
#include <WiFi.h>
1112
#include <WiFiClient.h>
@@ -43,6 +44,7 @@
4344
#define timezone 2 //for setdate command
4445
const char* ntpServer = "pool.ntp.org";
4546

47+
4648
#define Stay_Arm 0x01
4749
#define Stay_Arm2 0x02
4850
#define Sleep_Arm 0x03
@@ -57,19 +59,23 @@ const char* ntpServer = "pool.ntp.org";
5759
#define LED LED_BUILTIN
5860

5961
#define Uart0_RX
62+
#define TTLCD
63+
64+
6065

6166
//If esp is dev kit then set to 1 else 0
6267
bool ESPDEVKit = 1;
6368

6469
bool Hassio= 1; // 1 enables 0 disables Hassio-Openhab support
6570
bool HomeKit= 1 ;// enables homekit topic
6671
bool SendAllE0events =1 ;//If you need all events set to 1 else 0
67-
bool usePartitions= 1; //If you use partitions enable this to get partition number in Hassio topic
72+
bool usePartitions= 0; //If you use partitions enable this to get partition number in Hassio topic
6873

6974
int ArmStateRefresh = 30 ; //will send arm state every 30 seconds dont use smaller then 30, 0 to disable;
7075

7176
bool TRACE = 0;
7277
bool OTAUpdate = 0;
78+
bool HasTFTScreen = 0;
7379

7480
#define def_topicOut "out"
7581
#define def_topicStatus "status"
@@ -82,6 +88,16 @@ bool OTAUpdate = 0;
8288

8389
//#define ParadoxGSMInstalled // Comment out to use PARADOX GSMModule
8490
//#define Sim800Instaled //
91+
//#define HasTFTScreen //
92+
93+
94+
95+
#ifdef HasTFTScreen
96+
#include <tftScreen.h>
97+
HasTFTScreen =1;
98+
#endif
99+
100+
85101

86102

87103
#ifdef ParadoxGSMInstalled

0 commit comments

Comments
 (0)