mirror of
https://github.com/lumapu/ahoy.git
synced 2025-07-08 20:17:16 +02:00
0.8.105
* cleanup of `defines.h`
This commit is contained in:
parent
5a32288536
commit
29adc76936
6 changed files with 68 additions and 62 deletions
|
@ -27,11 +27,22 @@ def getFlagsOfEnv(env):
|
||||||
elif len(flags[i]) > 0:
|
elif len(flags[i]) > 0:
|
||||||
build_flags = build_flags + [flags[i]]
|
build_flags = build_flags + [flags[i]]
|
||||||
|
|
||||||
|
def parseDefinesH():
|
||||||
|
global build_flags
|
||||||
|
pattern = r'^\s*#\s*define\s+(\w+)'
|
||||||
|
|
||||||
|
with open("defines.h", "r") as f:
|
||||||
|
for line in f:
|
||||||
|
match = re.match(pattern, line)
|
||||||
|
if match:
|
||||||
|
build_flags += [match.group(1)]
|
||||||
|
|
||||||
|
|
||||||
def get_build_flags():
|
def get_build_flags():
|
||||||
getFlagsOfEnv("env:" + env['PIOENV'])
|
getFlagsOfEnv("env:" + env['PIOENV'])
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
config.read('platformio.ini')
|
config.read('platformio.ini')
|
||||||
|
parseDefinesH()
|
||||||
|
|
||||||
# translate board
|
# translate board
|
||||||
board = config["env:" + env['PIOENV']]['board']
|
board = config["env:" + env['PIOENV']]['board']
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
# Development Changes
|
# Development Changes
|
||||||
|
|
||||||
|
## 0.8.105 - 2024-04-05
|
||||||
|
* cleanup of `defines.h`
|
||||||
|
|
||||||
## 0.8.104 - 2024-04-04
|
## 0.8.104 - 2024-04-04
|
||||||
* fix reboot on inverter save (ESP32) #1559
|
* fix reboot on inverter save (ESP32) #1559
|
||||||
* fix NRF and Ethernet #1506
|
* fix NRF and Ethernet #1506
|
||||||
|
|
|
@ -33,7 +33,6 @@
|
||||||
|
|
||||||
#define CONFIG_VERSION 11
|
#define CONFIG_VERSION 11
|
||||||
|
|
||||||
|
|
||||||
#define PROT_MASK_INDEX 0x0001
|
#define PROT_MASK_INDEX 0x0001
|
||||||
#define PROT_MASK_LIVE 0x0002
|
#define PROT_MASK_LIVE 0x0002
|
||||||
#define PROT_MASK_SERIAL 0x0004
|
#define PROT_MASK_SERIAL 0x0004
|
||||||
|
@ -55,6 +54,20 @@
|
||||||
#define DEF_PROT_MQTT 0x0000
|
#define DEF_PROT_MQTT 0x0000
|
||||||
|
|
||||||
|
|
||||||
|
#define SSID_LEN 32
|
||||||
|
#define PWD_LEN 64
|
||||||
|
#define DEVNAME_LEN 16
|
||||||
|
#define NTP_ADDR_LEN 32 // DNS Name
|
||||||
|
|
||||||
|
#define MQTT_ADDR_LEN 64 // DNS Name
|
||||||
|
#define MQTT_CLIENTID_LEN 22 // number of chars is limited to 23 up to v3.1 of MQTT
|
||||||
|
#define MQTT_USER_LEN 65 // there is another byte necessary for \0
|
||||||
|
#define MQTT_PWD_LEN 65
|
||||||
|
#define MQTT_TOPIC_LEN 65
|
||||||
|
|
||||||
|
#define MQTT_MAX_PACKET_SIZE 384
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t ip[4]; // ip address
|
uint8_t ip[4]; // ip address
|
||||||
uint8_t mask[4]; // sub mask
|
uint8_t mask[4]; // sub mask
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
//-------------------------------------
|
//-------------------------------------
|
||||||
#define VERSION_MAJOR 0
|
#define VERSION_MAJOR 0
|
||||||
#define VERSION_MINOR 8
|
#define VERSION_MINOR 8
|
||||||
#define VERSION_PATCH 104
|
#define VERSION_PATCH 105
|
||||||
//-------------------------------------
|
//-------------------------------------
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t ch;
|
uint8_t ch;
|
||||||
|
@ -23,41 +23,6 @@ typedef struct {
|
||||||
uint16_t millis;
|
uint16_t millis;
|
||||||
} packet_t;
|
} packet_t;
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
InverterDevInform_Simple = 0, // 0x00
|
|
||||||
InverterDevInform_All = 1, // 0x01
|
|
||||||
GridOnProFilePara = 2, // 0x02
|
|
||||||
HardWareConfig = 3, // 0x03
|
|
||||||
SimpleCalibrationPara = 4, // 0x04
|
|
||||||
SystemConfigPara = 5, // 0x05
|
|
||||||
RealTimeRunData_Debug = 11, // 0x0b
|
|
||||||
RealTimeRunData_Reality = 12, // 0x0c
|
|
||||||
RealTimeRunData_A_Phase = 13, // 0x0d
|
|
||||||
RealTimeRunData_B_Phase = 14, // 0x0e
|
|
||||||
RealTimeRunData_C_Phase = 15, // 0x0f
|
|
||||||
AlarmData = 17, // 0x11, Alarm data - all unsent alarms
|
|
||||||
AlarmUpdate = 18, // 0x12, Alarm data - all pending alarms
|
|
||||||
RecordData = 19, // 0x13
|
|
||||||
InternalData = 20, // 0x14
|
|
||||||
GetLossRate = 21, // 0x15
|
|
||||||
GetSelfCheckState = 30, // 0x1e
|
|
||||||
InitDataState = 0xff
|
|
||||||
} InfoCmdType;
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
TurnOn = 0, // 0x00
|
|
||||||
TurnOff = 1, // 0x01
|
|
||||||
Restart = 2, // 0x02
|
|
||||||
Lock = 3, // 0x03
|
|
||||||
Unlock = 4, // 0x04
|
|
||||||
ActivePowerContr = 11, // 0x0b
|
|
||||||
ReactivePowerContr = 12, // 0x0c
|
|
||||||
PFSet = 13, // 0x0d
|
|
||||||
CleanState_LockAndAlarm = 20, // 0x14
|
|
||||||
SelfInspection = 40, // 0x28, self-inspection of grid-connected protection files
|
|
||||||
Init = 0xff
|
|
||||||
} DevControlCmdType;
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
AbsolutNonPersistent = 0UL, // 0x0000
|
AbsolutNonPersistent = 0UL, // 0x0000
|
||||||
RelativNonPersistent = 1UL, // 0x0001
|
RelativNonPersistent = 1UL, // 0x0001
|
||||||
|
@ -70,13 +35,6 @@ union serial_u {
|
||||||
uint8_t b[8];
|
uint8_t b[8];
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MIN_SERIAL_INTERVAL 2 // 5
|
|
||||||
#define MIN_SEND_INTERVAL 15
|
|
||||||
#define MIN_MQTT_INTERVAL 60
|
|
||||||
|
|
||||||
|
|
||||||
enum {MQTT_STATUS_OFFLINE = 0, MQTT_STATUS_PARTIAL, MQTT_STATUS_ONLINE};
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
DISP_TYPE_T0_NONE = 0,
|
DISP_TYPE_T0_NONE = 0,
|
||||||
DISP_TYPE_T1_SSD1306_128X64 = 1,
|
DISP_TYPE_T1_SSD1306_128X64 = 1,
|
||||||
|
@ -88,24 +46,6 @@ enum {
|
||||||
DISP_TYPE_T10_EPAPER = 10
|
DISP_TYPE_T10_EPAPER = 10
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------
|
|
||||||
// EEPROM
|
|
||||||
//-------------------------------------
|
|
||||||
#define SSID_LEN 32
|
|
||||||
#define PWD_LEN 64
|
|
||||||
#define DEVNAME_LEN 16
|
|
||||||
#define NTP_ADDR_LEN 32 // DNS Name
|
|
||||||
|
|
||||||
#define MQTT_ADDR_LEN 64 // DNS Name
|
|
||||||
#define MQTT_CLIENTID_LEN 22 // number of chars is limited to 23 up to v3.1 of MQTT
|
|
||||||
#define MQTT_USER_LEN 65 // there is another byte necessary for \0
|
|
||||||
#define MQTT_PWD_LEN 65
|
|
||||||
#define MQTT_TOPIC_LEN 65
|
|
||||||
|
|
||||||
#define MQTT_MAX_PACKET_SIZE 384
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint32_t rxFail;
|
uint32_t rxFail;
|
||||||
uint32_t rxFailNoAnswer;
|
uint32_t rxFailNoAnswer;
|
||||||
|
|
|
@ -9,6 +9,41 @@
|
||||||
#include "../utils/dbg.h"
|
#include "../utils/dbg.h"
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
InverterDevInform_Simple = 0, // 0x00
|
||||||
|
InverterDevInform_All = 1, // 0x01
|
||||||
|
GridOnProFilePara = 2, // 0x02
|
||||||
|
HardWareConfig = 3, // 0x03
|
||||||
|
SimpleCalibrationPara = 4, // 0x04
|
||||||
|
SystemConfigPara = 5, // 0x05
|
||||||
|
RealTimeRunData_Debug = 11, // 0x0b
|
||||||
|
RealTimeRunData_Reality = 12, // 0x0c
|
||||||
|
RealTimeRunData_A_Phase = 13, // 0x0d
|
||||||
|
RealTimeRunData_B_Phase = 14, // 0x0e
|
||||||
|
RealTimeRunData_C_Phase = 15, // 0x0f
|
||||||
|
AlarmData = 17, // 0x11, Alarm data - all unsent alarms
|
||||||
|
AlarmUpdate = 18, // 0x12, Alarm data - all pending alarms
|
||||||
|
RecordData = 19, // 0x13
|
||||||
|
InternalData = 20, // 0x14
|
||||||
|
GetLossRate = 21, // 0x15
|
||||||
|
GetSelfCheckState = 30, // 0x1e
|
||||||
|
InitDataState = 0xff
|
||||||
|
} InfoCmdType;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
TurnOn = 0, // 0x00
|
||||||
|
TurnOff = 1, // 0x01
|
||||||
|
Restart = 2, // 0x02
|
||||||
|
Lock = 3, // 0x03
|
||||||
|
Unlock = 4, // 0x04
|
||||||
|
ActivePowerContr = 11, // 0x0b
|
||||||
|
ReactivePowerContr = 12, // 0x0c
|
||||||
|
PFSet = 13, // 0x0d
|
||||||
|
CleanState_LockAndAlarm = 20, // 0x14
|
||||||
|
SelfInspection = 40, // 0x28, self-inspection of grid-connected protection files
|
||||||
|
Init = 0xff
|
||||||
|
} DevControlCmdType;
|
||||||
|
|
||||||
// inverter generations
|
// inverter generations
|
||||||
enum {IV_MI = 0, IV_HM, IV_HMS, IV_HMT, IV_UNKNOWN};
|
enum {IV_MI = 0, IV_HM, IV_HMS, IV_HMT, IV_UNKNOWN};
|
||||||
const char* const generationNames[] = {"MI", "HM", "HMS", "HMT", "UNKNOWN"};
|
const char* const generationNames[] = {"MI", "HM", "HMS", "HMT", "UNKNOWN"};
|
||||||
|
|
|
@ -602,6 +602,10 @@ class PubMqtt {
|
||||||
mLastAnyAvail = anyAvail;
|
mLastAnyAvail = anyAvail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
enum {MQTT_STATUS_OFFLINE = 0, MQTT_STATUS_PARTIAL, MQTT_STATUS_ONLINE};
|
||||||
|
|
||||||
|
private:
|
||||||
espMqttClient mClient;
|
espMqttClient mClient;
|
||||||
cfgMqtt_t *mCfgMqtt = nullptr;
|
cfgMqtt_t *mCfgMqtt = nullptr;
|
||||||
IApp *mApp;
|
IApp *mApp;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue