mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
Merge branch 'emsesp:dev' into dev
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
},
|
},
|
||||||
"core": "esp32",
|
"core": "esp32",
|
||||||
"extra_flags": [
|
"extra_flags": [
|
||||||
|
"-DTASMOTA_SDK",
|
||||||
"-DARDUINO_LOLIN_C3_MINI",
|
"-DARDUINO_LOLIN_C3_MINI",
|
||||||
"-DARDUINO_USB_MODE=1",
|
"-DARDUINO_USB_MODE=1",
|
||||||
"-DARDUINO_USB_CDC_ON_BOOT=1"
|
"-DARDUINO_USB_CDC_ON_BOOT=1"
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ export interface Settings {
|
|||||||
dallas_gpio: number;
|
dallas_gpio: number;
|
||||||
dallas_parasite: boolean;
|
dallas_parasite: boolean;
|
||||||
led_gpio: number;
|
led_gpio: number;
|
||||||
|
led_type: number;
|
||||||
hide_led: boolean;
|
hide_led: boolean;
|
||||||
low_clock: boolean;
|
low_clock: boolean;
|
||||||
notoken_api: boolean;
|
notoken_api: boolean;
|
||||||
@@ -262,6 +263,7 @@ export const BOARD_PROFILES: BoardProfiles = {
|
|||||||
export interface BoardProfile {
|
export interface BoardProfile {
|
||||||
board_profile: string;
|
board_profile: string;
|
||||||
led_gpio: number;
|
led_gpio: number;
|
||||||
|
led_type: number;
|
||||||
dallas_gpio: number;
|
dallas_gpio: number;
|
||||||
rx_gpio: number;
|
rx_gpio: number;
|
||||||
tx_gpio: number;
|
tx_gpio: number;
|
||||||
|
|||||||
@@ -550,6 +550,23 @@ const ApplicationSettings = () => {
|
|||||||
margin="normal"
|
margin="normal"
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
{data.led_gpio !== 0 && (
|
||||||
|
<Grid>
|
||||||
|
<TextField
|
||||||
|
name="led_type"
|
||||||
|
label={'LED ' + LL.TYPE()}
|
||||||
|
value={data.led_type}
|
||||||
|
fullWidth
|
||||||
|
variant="outlined"
|
||||||
|
onChange={updateFormValue}
|
||||||
|
margin="normal"
|
||||||
|
select
|
||||||
|
>
|
||||||
|
<MenuItem value={0}>LED</MenuItem>
|
||||||
|
<MenuItem value={1}>RGB-LED</MenuItem>
|
||||||
|
</TextField>
|
||||||
|
</Grid>
|
||||||
|
)}
|
||||||
<Grid>
|
<Grid>
|
||||||
<TextField
|
<TextField
|
||||||
name="phy_type"
|
name="phy_type"
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ const SystemLog = () => {
|
|||||||
const [readOpen, setReadOpen] = useState(false);
|
const [readOpen, setReadOpen] = useState(false);
|
||||||
const [logEntries, setLogEntries] = useState<LogEntry[]>([]);
|
const [logEntries, setLogEntries] = useState<LogEntry[]>([]);
|
||||||
const [autoscroll, setAutoscroll] = useState(true);
|
const [autoscroll, setAutoscroll] = useState(true);
|
||||||
|
const [lastId, setLastId] = useState<number>(-1);
|
||||||
|
|
||||||
const ALPHA_NUMERIC_DASH_REGEX = /^[a-fA-F0-9 ]+$/;
|
const ALPHA_NUMERIC_DASH_REGEX = /^[a-fA-F0-9 ]+$/;
|
||||||
|
|
||||||
@@ -118,7 +119,10 @@ const SystemLog = () => {
|
|||||||
.onMessage((message: { data: string }) => {
|
.onMessage((message: { data: string }) => {
|
||||||
const rawData = message.data;
|
const rawData = message.data;
|
||||||
const logentry = JSON.parse(rawData) as LogEntry;
|
const logentry = JSON.parse(rawData) as LogEntry;
|
||||||
setLogEntries((log) => [...log, logentry]);
|
if (lastId < logentry.i) {
|
||||||
|
setLogEntries((log) => [...log, logentry]);
|
||||||
|
setLastId(logentry.i);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.onError(() => {
|
.onError(() => {
|
||||||
toast.error('No connection to Log service');
|
toast.error('No connection to Log service');
|
||||||
|
|||||||
@@ -343,10 +343,10 @@ const sk: Translation = {
|
|||||||
DEVELOPER_MODE: 'Režim vývojára',
|
DEVELOPER_MODE: 'Režim vývojára',
|
||||||
DUPLICATE: 'Duplicitné',
|
DUPLICATE: 'Duplicitné',
|
||||||
UPGRADE: 'Inovovať',
|
UPGRADE: 'Inovovať',
|
||||||
DASHBOARD_1: 'All EMS entities that are active and marked as Favorite, plus all Custom Entities, Schedules and external Sensors data are displayed below.', // TODO translate
|
DASHBOARD_1: 'Všetky entity EMS, ktoré sú aktívne a označené ako obľúbené, plus všetky vlastné entity, plány a údaje externých senzorov sú zobrazené nižšie.',
|
||||||
NO_DATA_1: 'No favourite EMS entities found. Use the', // TODO translate
|
NO_DATA_1: 'Nenašli sa žiadne obľúbené entity EMS. Použite',
|
||||||
NO_DATA_2: 'module to mark them.', // TODO translate
|
NO_DATA_2: 'modul na ich označenie.',
|
||||||
NO_DATA_3: 'To see all available entities go to' // TODO translate
|
NO_DATA_3: 'Ak chcete zobraziť všetky dostupné entity, prejdite na'
|
||||||
};
|
};
|
||||||
|
|
||||||
export default sk;
|
export default sk;
|
||||||
|
|||||||
@@ -180,10 +180,7 @@ extends = espressif32_base_T_4M
|
|||||||
board = c3_mini_4M
|
board = c3_mini_4M
|
||||||
build_flags =
|
build_flags =
|
||||||
${common.build_flags}
|
${common.build_flags}
|
||||||
-DTASMOTA_SDK
|
|
||||||
-DBOARD_C3_MINI_V1
|
-DBOARD_C3_MINI_V1
|
||||||
-DARDUINO_USB_MODE=1
|
|
||||||
-DARDUINO_USB_CDC_ON_BOOT=1
|
|
||||||
|
|
||||||
;
|
;
|
||||||
; Building and testing natively, standalone without an ESP32.
|
; Building and testing natively, standalone without an ESP32.
|
||||||
|
|||||||
@@ -762,10 +762,10 @@ MAKE_TRANSLATION(vacations5, "vacations5", "vacation dates 5", "Urlaubstage 5",
|
|||||||
MAKE_TRANSLATION(vacations6, "vacations6", "vacation dates 6", "Urlaubstage 6", "Vakantiedagen 6", "Semesterdatum 6", "urlop 6", "feriedager 6", "dates vacances 6", "izin günleri 6", "date vacanze 6", "termíny dovolenky 6", "data prázdnin 6")
|
MAKE_TRANSLATION(vacations6, "vacations6", "vacation dates 6", "Urlaubstage 6", "Vakantiedagen 6", "Semesterdatum 6", "urlop 6", "feriedager 6", "dates vacances 6", "izin günleri 6", "date vacanze 6", "termíny dovolenky 6", "data prázdnin 6")
|
||||||
MAKE_TRANSLATION(vacations7, "vacations7", "vacation dates 7", "Urlaubstage 7", "Vakantiedagen 7", "Semesterdatum 7", "urlop 7", "feriedager 7", "dates vacances 7", "izin günleri 7", "date vacanze 7", "termíny dovolenky 7", "data prázdnin 7")
|
MAKE_TRANSLATION(vacations7, "vacations7", "vacation dates 7", "Urlaubstage 7", "Vakantiedagen 7", "Semesterdatum 7", "urlop 7", "feriedager 7", "dates vacances 7", "izin günleri 7", "date vacanze 7", "termíny dovolenky 7", "data prázdnin 7")
|
||||||
MAKE_TRANSLATION(vacations8, "vacations8", "vacation dates 8", "Urlaubstage 8", "Vakantiedagen 8", "Semesterdatum 8", "urlop 8", "feriedager 8", "dates vacances 8", "izin günleri 8", "date vacanze 8", "termíny dovolenky 8", "data prázdnin 8")
|
MAKE_TRANSLATION(vacations8, "vacations8", "vacation dates 8", "Urlaubstage 8", "Vakantiedagen 8", "Semesterdatum 8", "urlop 8", "feriedager 8", "dates vacances 8", "izin günleri 8", "date vacanze 8", "termíny dovolenky 8", "data prázdnin 8")
|
||||||
MAKE_TRANSLATION(absent, "absent", "absent", "Abwesend", "", "Frånvarande", "", "", "", "", "", "chýnajúci", "") // TODO translate
|
MAKE_TRANSLATION(absent, "absent", "absent", "Abwesend", "", "Frånvarande", "", "", "", "", "", "chýbajúci", "") // TODO translate
|
||||||
MAKE_TRANSLATION(redthreshold, "redthreshold", "reduction threshold", "Absenkschwelle", "", "Tröskel för sänkning", "", "", "", "", "", "zníženie tresholdu", "") // TODO translate
|
MAKE_TRANSLATION(redthreshold, "redthreshold", "reduction threshold", "Absenkschwelle", "", "Tröskel för sänkning", "", "", "", "", "", "zníženie tresholdu", "") // TODO translate
|
||||||
MAKE_TRANSLATION(solarinfl, "solarinfl", "solar influence", "Solareinfluß", "", "", "", "", "", "", "", "", "") // TODO translate
|
MAKE_TRANSLATION(solarinfl, "solarinfl", "solar influence", "Solareinfluß", "", "", "", "", "", "", "", "slnečný vplyv", "") // TODO translate
|
||||||
MAKE_TRANSLATION(currsolarinfl, "currsolarinfl", "curent solar influence", "akt. Solareinfluß", "", "", "", "", "", "", "", "", "") // TODO translate
|
MAKE_TRANSLATION(currsolarinfl, "currsolarinfl", "curent solar influence", "akt. Solareinfluß", "", "", "", "", "", "", "", "aktuálny slnečný vplyv", "") // TODO translate
|
||||||
|
|
||||||
MAKE_TRANSLATION(hpmode, "hpmode", "HP Mode", "WP-Modus", "Modus warmtepomp", "Värmepumpsläge", "tryb pracy pompy ciepła", "", "", "yüksek güç modu", "Modalità Termopompa", "Režim TČ", "režim tepelného čerpadla") // TODO translate
|
MAKE_TRANSLATION(hpmode, "hpmode", "HP Mode", "WP-Modus", "Modus warmtepomp", "Värmepumpsläge", "tryb pracy pompy ciepła", "", "", "yüksek güç modu", "Modalità Termopompa", "Režim TČ", "režim tepelného čerpadla") // TODO translate
|
||||||
MAKE_TRANSLATION(dewoffset, "dewoffset", "dew point offset", "Taupunktdifferenz", "Offset dauwpunt", "Daggpunktsförskjutning", "przesunięcie punktu rosy", "", "", "çiğ noktası göreli", "differenza del punto di rugiada", "posun rosného bodu", "offset rosného bodu") // TODO translate
|
MAKE_TRANSLATION(dewoffset, "dewoffset", "dew point offset", "Taupunktdifferenz", "Offset dauwpunt", "Daggpunktsförskjutning", "przesunięcie punktu rosy", "", "", "çiğ noktası göreli", "differenza del punto di rugiada", "posun rosného bodu", "offset rosného bodu") // TODO translate
|
||||||
|
|||||||
@@ -381,6 +381,7 @@ void System::reload_settings() {
|
|||||||
analog_enabled_ = settings.analog_enabled;
|
analog_enabled_ = settings.analog_enabled;
|
||||||
low_clock_ = settings.low_clock;
|
low_clock_ = settings.low_clock;
|
||||||
hide_led_ = settings.hide_led;
|
hide_led_ = settings.hide_led;
|
||||||
|
led_type_ = settings.led_type;
|
||||||
led_gpio_ = settings.led_gpio;
|
led_gpio_ = settings.led_gpio;
|
||||||
board_profile_ = settings.board_profile;
|
board_profile_ = settings.board_profile;
|
||||||
telnet_enabled_ = settings.telnet_enabled;
|
telnet_enabled_ = settings.telnet_enabled;
|
||||||
@@ -551,13 +552,13 @@ void System::led_init(bool refresh) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((led_gpio_ != 0) && is_valid_gpio(led_gpio_)) {
|
if ((led_gpio_ != 0) && is_valid_gpio(led_gpio_)) {
|
||||||
#if defined(ARDUINO_LOLIN_C3_MINI) && !defined(BOARD_C3_MINI_V1)
|
if (led_type_) {
|
||||||
// rgb LED WS2812B, use Adafruit Neopixel
|
// rgb LED WS2812B, use Adafruit Neopixel
|
||||||
neopixelWrite(led_gpio_, 0, 0, 0);
|
neopixelWrite(led_gpio_, 0, 0, 0);
|
||||||
#else
|
} else {
|
||||||
pinMode(led_gpio_, OUTPUT); // 0 means disabled
|
pinMode(led_gpio_, OUTPUT); // 0 means disabled
|
||||||
digitalWrite(led_gpio_, !LED_ON); // start with LED off
|
digitalWrite(led_gpio_, !LED_ON); // start with LED off
|
||||||
#endif
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -686,7 +687,7 @@ void System::heartbeat_json(JsonObject output) {
|
|||||||
output["freemem"] = getHeapMem();
|
output["freemem"] = getHeapMem();
|
||||||
output["max_alloc"] = getMaxAllocMem();
|
output["max_alloc"] = getMaxAllocMem();
|
||||||
#if CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32
|
#if CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32
|
||||||
output["temperature"] = temperature_;
|
output["temperature"] = (int)temperature_;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -810,20 +811,12 @@ void System::system_check() {
|
|||||||
if (healthcheck_ == 0) {
|
if (healthcheck_ == 0) {
|
||||||
// everything is healthy, show LED permanently on or off depending on setting
|
// everything is healthy, show LED permanently on or off depending on setting
|
||||||
if (led_gpio_) {
|
if (led_gpio_) {
|
||||||
#if defined(ARDUINO_LOLIN_C3_MINI) && !defined(BOARD_C3_MINI_V1)
|
led_type_ ? neopixelWrite(led_gpio_, 0, hide_led_ ? 0 : 128, 0) : digitalWrite(led_gpio_, hide_led_ ? !LED_ON : LED_ON);
|
||||||
neopixelWrite(led_gpio_, 0, hide_led_ ? 0 : 128, 0);
|
|
||||||
#else
|
|
||||||
digitalWrite(led_gpio_, hide_led_ ? !LED_ON : LED_ON);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// turn off LED so we're ready to the flashes
|
// turn off LED so we're ready to the flashes
|
||||||
if (led_gpio_) {
|
if (led_gpio_) {
|
||||||
#if defined(ARDUINO_LOLIN_C3_MINI) && !defined(BOARD_C3_MINI_V1)
|
led_type_ ? neopixelWrite(led_gpio_, 0, 0, 0) : digitalWrite(led_gpio_, !LED_ON);
|
||||||
neopixelWrite(led_gpio_, 0, 0, 0);
|
|
||||||
#else
|
|
||||||
digitalWrite(led_gpio_, !LED_ON);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -883,60 +876,51 @@ void System::led_monitor() {
|
|||||||
// reset the whole sequence
|
// reset the whole sequence
|
||||||
led_long_timer_ = uuid::get_uptime();
|
led_long_timer_ = uuid::get_uptime();
|
||||||
led_flash_step_ = 0;
|
led_flash_step_ = 0;
|
||||||
#if defined(ARDUINO_LOLIN_C3_MINI) && !defined(BOARD_C3_MINI_V1)
|
led_type_ ? neopixelWrite(led_gpio_, 0, 0, 0) : digitalWrite(led_gpio_, !LED_ON); // LED off
|
||||||
neopixelWrite(led_gpio_, 0, 0, 0);
|
|
||||||
#else
|
|
||||||
digitalWrite(led_gpio_, !LED_ON); // LED off
|
|
||||||
#endif
|
|
||||||
} else if (led_flash_step_ % 2) {
|
} else if (led_flash_step_ % 2) {
|
||||||
// handle the step events (on odd numbers 3,5,7,etc). see if we need to turn on a LED
|
// handle the step events (on odd numbers 3,5,7,etc). see if we need to turn on a LED
|
||||||
// 1 flash is the EMS bus is not connected
|
// 1 flash is the EMS bus is not connected
|
||||||
// 2 flashes if the network (wifi or ethernet) is not connected
|
// 2 flashes if the network (wifi or ethernet) is not connected
|
||||||
// 3 flashes is both the bus and the network are not connected. Then you know you're truly f*cked.
|
// 3 flashes is both the bus and the network are not connected. Then you know you're truly f*cked.
|
||||||
|
|
||||||
#if defined(ARDUINO_LOLIN_C3_MINI) && !defined(BOARD_C3_MINI_V1)
|
if (led_type_) {
|
||||||
if (led_flash_step_ == 3) {
|
if (led_flash_step_ == 3) {
|
||||||
if ((healthcheck_ & HEALTHCHECK_NO_NETWORK) == HEALTHCHECK_NO_NETWORK) {
|
if ((healthcheck_ & HEALTHCHECK_NO_NETWORK) == HEALTHCHECK_NO_NETWORK) {
|
||||||
|
neopixelWrite(led_gpio_, 128, 0, 0); // red
|
||||||
|
} else if ((healthcheck_ & HEALTHCHECK_NO_BUS) == HEALTHCHECK_NO_BUS) {
|
||||||
|
neopixelWrite(led_gpio_, 0, 0, 128); // blue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (led_flash_step_ == 5 && (healthcheck_ & HEALTHCHECK_NO_NETWORK) == HEALTHCHECK_NO_NETWORK) {
|
||||||
neopixelWrite(led_gpio_, 128, 0, 0); // red
|
neopixelWrite(led_gpio_, 128, 0, 0); // red
|
||||||
} else if ((healthcheck_ & HEALTHCHECK_NO_BUS) == HEALTHCHECK_NO_BUS) {
|
}
|
||||||
|
if ((led_flash_step_ == 7) && ((healthcheck_ & HEALTHCHECK_NO_NETWORK) == HEALTHCHECK_NO_NETWORK)
|
||||||
|
&& ((healthcheck_ & HEALTHCHECK_NO_BUS) == HEALTHCHECK_NO_BUS)) {
|
||||||
neopixelWrite(led_gpio_, 0, 0, 128); // blue
|
neopixelWrite(led_gpio_, 0, 0, 128); // blue
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
if (led_flash_step_ == 5 && (healthcheck_ & HEALTHCHECK_NO_NETWORK) == HEALTHCHECK_NO_NETWORK) {
|
if ((led_flash_step_ == 3)
|
||||||
neopixelWrite(led_gpio_, 128, 0, 0); // red
|
&& (((healthcheck_ & HEALTHCHECK_NO_NETWORK) == HEALTHCHECK_NO_NETWORK) || ((healthcheck_ & HEALTHCHECK_NO_BUS) == HEALTHCHECK_NO_BUS))) {
|
||||||
}
|
led_on_ = true;
|
||||||
if ((led_flash_step_ == 7) && ((healthcheck_ & HEALTHCHECK_NO_NETWORK) == HEALTHCHECK_NO_NETWORK)
|
}
|
||||||
&& ((healthcheck_ & HEALTHCHECK_NO_BUS) == HEALTHCHECK_NO_BUS)) {
|
|
||||||
neopixelWrite(led_gpio_, 0, 0, 128); // blue
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
|
|
||||||
if ((led_flash_step_ == 3)
|
if ((led_flash_step_ == 5) && ((healthcheck_ & HEALTHCHECK_NO_NETWORK) == HEALTHCHECK_NO_NETWORK)) {
|
||||||
&& (((healthcheck_ & HEALTHCHECK_NO_NETWORK) == HEALTHCHECK_NO_NETWORK) || ((healthcheck_ & HEALTHCHECK_NO_BUS) == HEALTHCHECK_NO_BUS))) {
|
led_on_ = true;
|
||||||
led_on_ = true;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if ((led_flash_step_ == 5) && ((healthcheck_ & HEALTHCHECK_NO_NETWORK) == HEALTHCHECK_NO_NETWORK)) {
|
if ((led_flash_step_ == 7) && ((healthcheck_ & HEALTHCHECK_NO_NETWORK) == HEALTHCHECK_NO_NETWORK)
|
||||||
led_on_ = true;
|
&& ((healthcheck_ & HEALTHCHECK_NO_BUS) == HEALTHCHECK_NO_BUS)) {
|
||||||
}
|
led_on_ = true;
|
||||||
|
}
|
||||||
|
|
||||||
if ((led_flash_step_ == 7) && ((healthcheck_ & HEALTHCHECK_NO_NETWORK) == HEALTHCHECK_NO_NETWORK)
|
if (led_on_) {
|
||||||
&& ((healthcheck_ & HEALTHCHECK_NO_BUS) == HEALTHCHECK_NO_BUS)) {
|
digitalWrite(led_gpio_, LED_ON); // LED off
|
||||||
led_on_ = true;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (led_on_) {
|
|
||||||
digitalWrite(led_gpio_, LED_ON); // LED off
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
// turn the led off after the flash, on even number count
|
// turn the led off after the flash, on even number count
|
||||||
if (led_on_) {
|
if (led_on_) {
|
||||||
#if defined(ARDUINO_LOLIN_C3_MINI) && !defined(BOARD_C3_MINI_V1)
|
led_type_ ? neopixelWrite(led_gpio_, 0, 0, 0) : digitalWrite(led_gpio_, !LED_ON);
|
||||||
neopixelWrite(led_gpio_, 0, 0, 0);
|
|
||||||
#else
|
|
||||||
digitalWrite(led_gpio_, !LED_ON); // LED off
|
|
||||||
#endif
|
|
||||||
led_on_ = false;
|
led_on_ = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1725,6 +1709,7 @@ bool System::command_info(const char * value, const int8_t id, JsonObject output
|
|||||||
node["dallasGPIO"] = settings.dallas_gpio;
|
node["dallasGPIO"] = settings.dallas_gpio;
|
||||||
node["pbuttonGPIO"] = settings.pbutton_gpio;
|
node["pbuttonGPIO"] = settings.pbutton_gpio;
|
||||||
node["ledGPIO"] = settings.led_gpio;
|
node["ledGPIO"] = settings.led_gpio;
|
||||||
|
node["ledType"] = settings.led_type;
|
||||||
}
|
}
|
||||||
node["hideLed"] = settings.hide_led;
|
node["hideLed"] = settings.hide_led;
|
||||||
node["noTokenApi"] = settings.notoken_api;
|
node["noTokenApi"] = settings.notoken_api;
|
||||||
@@ -1837,29 +1822,33 @@ bool System::command_test(const char * value, const int8_t id) {
|
|||||||
// 3 = RMII clock output from GPIO17, for 50hz inverted clock
|
// 3 = RMII clock output from GPIO17, for 50hz inverted clock
|
||||||
bool System::load_board_profile(std::vector<int8_t> & data, const std::string & board_profile) {
|
bool System::load_board_profile(std::vector<int8_t> & data, const std::string & board_profile) {
|
||||||
if (board_profile == "S32") {
|
if (board_profile == "S32") {
|
||||||
data = {2, 18, 23, 5, 0, PHY_type::PHY_TYPE_NONE, 0, 0, 0}; // BBQKees Gateway S32
|
data = {2, 18, 23, 5, 0, PHY_type::PHY_TYPE_NONE, 0, 0, 0, 0}; // BBQKees Gateway S32
|
||||||
} else if (board_profile == "E32") {
|
} else if (board_profile == "E32") {
|
||||||
data = {2, 4, 5, 17, 33, PHY_type::PHY_TYPE_LAN8720, 16, 1, 0}; // BBQKees Gateway E32
|
data = {2, 4, 5, 17, 33, PHY_type::PHY_TYPE_LAN8720, 16, 1, 0, 0}; // BBQKees Gateway E32
|
||||||
} else if (board_profile == "E32V2") {
|
} else if (board_profile == "E32V2") {
|
||||||
data = {2, 14, 4, 5, 34, PHY_type::PHY_TYPE_LAN8720, 15, 0, 1}; // BBQKees Gateway E32 V2
|
data = {2, 14, 4, 5, 34, PHY_type::PHY_TYPE_LAN8720, 15, 0, 1, 0}; // BBQKees Gateway E32 V2
|
||||||
} else if (board_profile == "MH-ET") {
|
} else if (board_profile == "MH-ET") {
|
||||||
data = {2, 18, 23, 5, 0, PHY_type::PHY_TYPE_NONE, 0, 0, 0}; // MH-ET Live D1 Mini
|
data = {2, 18, 23, 5, 0, PHY_type::PHY_TYPE_NONE, 0, 0, 0, 0}; // MH-ET Live D1 Mini
|
||||||
} else if (board_profile == "NODEMCU") {
|
} else if (board_profile == "NODEMCU") {
|
||||||
data = {2, 18, 23, 5, 0, PHY_type::PHY_TYPE_NONE, 0, 0, 0}; // NodeMCU 32S
|
data = {2, 18, 23, 5, 0, PHY_type::PHY_TYPE_NONE, 0, 0, 0, 0}; // NodeMCU 32S
|
||||||
} else if (board_profile == "LOLIN") {
|
} else if (board_profile == "LOLIN") {
|
||||||
data = {2, 18, 17, 16, 0, PHY_type::PHY_TYPE_NONE, 0, 0, 0}; // Lolin D32
|
data = {2, 18, 17, 16, 0, PHY_type::PHY_TYPE_NONE, 0, 0, 0, 0}; // Lolin D32
|
||||||
} else if (board_profile == "OLIMEX") {
|
} else if (board_profile == "OLIMEX") {
|
||||||
data = {0, 0, 36, 4, 34, PHY_type::PHY_TYPE_LAN8720, -1, 0, 0}; // Olimex ESP32-EVB (uses U1TXD/U1RXD/BUTTON, no LED or Temperature sensor)
|
data = {0, 0, 36, 4, 34, PHY_type::PHY_TYPE_LAN8720, -1, 0, 0, 0}; // Olimex ESP32-EVB (uses U1TXD/U1RXD/BUTTON, no LED or Temperature sensor)
|
||||||
} else if (board_profile == "OLIMEXPOE") {
|
} else if (board_profile == "OLIMEXPOE") {
|
||||||
data = {0, 0, 36, 4, 34, PHY_type::PHY_TYPE_LAN8720, 12, 0, 3}; // Olimex ESP32-POE
|
data = {0, 0, 36, 4, 34, PHY_type::PHY_TYPE_LAN8720, 12, 0, 3, 0}; // Olimex ESP32-POE
|
||||||
} else if (board_profile == "C3MINI") {
|
} else if (board_profile == "C3MINI") {
|
||||||
data = {7, 1, 4, 5, 9, PHY_type::PHY_TYPE_NONE, 0, 0, 0}; // Lolin C3 Mini
|
#if defined(BOARD_C3_MINI_V1)
|
||||||
|
data = {7, 1, 4, 5, 9, PHY_type::PHY_TYPE_NONE, 0, 0, 0, 0}; // Lolin C3 Mini V1
|
||||||
|
#else
|
||||||
|
data = {7, 1, 4, 5, 9, PHY_type::PHY_TYPE_NONE, 0, 0, 0, 1}; // Lolin C3 Mini with RGB Led
|
||||||
|
#endif
|
||||||
} else if (board_profile == "S2MINI") {
|
} else if (board_profile == "S2MINI") {
|
||||||
data = {15, 7, 11, 12, 0, PHY_type::PHY_TYPE_NONE, 0, 0, 0}; // Lolin S2 Mini
|
data = {15, 7, 11, 12, 0, PHY_type::PHY_TYPE_NONE, 0, 0, 0, 0}; // Lolin S2 Mini
|
||||||
} else if (board_profile == "S3MINI") {
|
} else if (board_profile == "S3MINI") {
|
||||||
data = {17, 18, 8, 5, 0, PHY_type::PHY_TYPE_NONE, 0, 0, 0}; // Liligo S3
|
data = {17, 18, 8, 5, 0, PHY_type::PHY_TYPE_NONE, 0, 0, 0, 0}; // Liligo S3
|
||||||
} else if (board_profile == "S32S3") {
|
} else if (board_profile == "S32S3") {
|
||||||
data = {2, 18, 5, 17, 0, PHY_type::PHY_TYPE_NONE, 0, 0, 0}; // BBQKees Gateway S3
|
data = {2, 18, 5, 17, 0, PHY_type::PHY_TYPE_NONE, 0, 0, 0, 0}; // BBQKees Gateway S3
|
||||||
} else if (board_profile == "CUSTOM") {
|
} else if (board_profile == "CUSTOM") {
|
||||||
// send back current values
|
// send back current values
|
||||||
data = {(int8_t)EMSESP::system_.led_gpio_,
|
data = {(int8_t)EMSESP::system_.led_gpio_,
|
||||||
@@ -1870,7 +1859,8 @@ bool System::load_board_profile(std::vector<int8_t> & data, const std::string &
|
|||||||
(int8_t)EMSESP::system_.phy_type_,
|
(int8_t)EMSESP::system_.phy_type_,
|
||||||
EMSESP::system_.eth_power_,
|
EMSESP::system_.eth_power_,
|
||||||
(int8_t)EMSESP::system_.eth_phy_addr_,
|
(int8_t)EMSESP::system_.eth_phy_addr_,
|
||||||
(int8_t)EMSESP::system_.eth_clock_mode_};
|
(int8_t)EMSESP::system_.eth_clock_mode_,
|
||||||
|
(int8_t)EMSESP::system_.led_type_};
|
||||||
} else {
|
} else {
|
||||||
LOG_DEBUG("Couldn't identify board profile %s", board_profile.c_str());
|
LOG_DEBUG("Couldn't identify board profile %s", board_profile.c_str());
|
||||||
return false; // unknown, return false
|
return false; // unknown, return false
|
||||||
@@ -2064,9 +2054,7 @@ bool System::uploadFirmwareURL(const char * url) {
|
|||||||
// TODO do we need to stop the UART first with EMSuart::stop() ?
|
// TODO do we need to stop the UART first with EMSuart::stop() ?
|
||||||
|
|
||||||
// set a callback so we can monitor progress in the WebUI
|
// set a callback so we can monitor progress in the WebUI
|
||||||
Update.onProgress([](size_t progress, size_t total) {
|
Update.onProgress([](size_t progress, size_t total) { EMSESP::system_.systemStatus(SYSTEM_STATUS::SYSTEM_STATUS_UPLOADING + (progress * 100 / total)); });
|
||||||
EMSESP::system_.systemStatus(SYSTEM_STATUS::SYSTEM_STATUS_UPLOADING+(progress * 100 / total));
|
|
||||||
});
|
|
||||||
|
|
||||||
// get tcp stream and send it to Updater
|
// get tcp stream and send it to Updater
|
||||||
WiFiClient * stream = http.getStreamPtr();
|
WiFiClient * stream = http.getStreamPtr();
|
||||||
|
|||||||
@@ -394,6 +394,7 @@ class System {
|
|||||||
std::string hostname_;
|
std::string hostname_;
|
||||||
String locale_;
|
String locale_;
|
||||||
bool hide_led_;
|
bool hide_led_;
|
||||||
|
uint8_t led_type_;
|
||||||
uint8_t led_gpio_;
|
uint8_t led_gpio_;
|
||||||
bool analog_enabled_;
|
bool analog_enabled_;
|
||||||
bool low_clock_;
|
bool low_clock_;
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ void WebSettings::read(WebSettings & settings, JsonObject root) {
|
|||||||
root["dallas_parasite"] = settings.dallas_parasite;
|
root["dallas_parasite"] = settings.dallas_parasite;
|
||||||
root["led_gpio"] = settings.led_gpio;
|
root["led_gpio"] = settings.led_gpio;
|
||||||
root["hide_led"] = settings.hide_led;
|
root["hide_led"] = settings.hide_led;
|
||||||
|
root["led_type"] = settings.led_type;
|
||||||
root["low_clock"] = settings.low_clock;
|
root["low_clock"] = settings.low_clock;
|
||||||
root["telnet_enabled"] = settings.telnet_enabled;
|
root["telnet_enabled"] = settings.telnet_enabled;
|
||||||
root["notoken_api"] = settings.notoken_api;
|
root["notoken_api"] = settings.notoken_api;
|
||||||
@@ -103,6 +104,7 @@ StateUpdateResult WebSettings::update(JsonObject root, WebSettings & settings) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// get the current board profile saved in the settings file
|
// get the current board profile saved in the settings file
|
||||||
|
String org_board_profile = settings.board_profile;
|
||||||
settings.board_profile = root["board_profile"] | EMSESP_DEFAULT_BOARD_PROFILE; // this is set at compile time in platformio.ini, other it's "default"
|
settings.board_profile = root["board_profile"] | EMSESP_DEFAULT_BOARD_PROFILE; // this is set at compile time in platformio.ini, other it's "default"
|
||||||
String old_board_profile = settings.board_profile;
|
String old_board_profile = settings.board_profile;
|
||||||
|
|
||||||
@@ -133,7 +135,12 @@ StateUpdateResult WebSettings::update(JsonObject root, WebSettings & settings) {
|
|||||||
(int8_t)(root["phy_type"] | PHY_type::PHY_TYPE_NONE),
|
(int8_t)(root["phy_type"] | PHY_type::PHY_TYPE_NONE),
|
||||||
(int8_t)(root["eth_power"] | 0),
|
(int8_t)(root["eth_power"] | 0),
|
||||||
(int8_t)(root["eth_phy_addr"] | 0),
|
(int8_t)(root["eth_phy_addr"] | 0),
|
||||||
(int8_t)(root["eth_clock_mode"] | 0)};
|
(int8_t)(root["eth_clock_mode"] | 0),
|
||||||
|
#if defined(ARDUINO_LOLIN_C3_MINI) && !defined(BOARD_C3_MINI_V1)
|
||||||
|
(int8_t)(root["led_type"] | 1)};
|
||||||
|
#else
|
||||||
|
(int8_t)(root["led_type"] | 0)};
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
// check valid pins in this board profile
|
// check valid pins in this board profile
|
||||||
if (!System::is_valid_gpio(data[0], psram) || !System::is_valid_gpio(data[1], psram) || !System::is_valid_gpio(data[2], psram)
|
if (!System::is_valid_gpio(data[0], psram) || !System::is_valid_gpio(data[1], psram) || !System::is_valid_gpio(data[2], psram)
|
||||||
@@ -180,11 +187,11 @@ StateUpdateResult WebSettings::update(JsonObject root, WebSettings & settings) {
|
|||||||
|
|
||||||
// override if we know the target from the build config like C3, S2, S3 etc..
|
// override if we know the target from the build config like C3, S2, S3 etc..
|
||||||
#elif CONFIG_IDF_TARGET_ESP32C3
|
#elif CONFIG_IDF_TARGET_ESP32C3
|
||||||
settings.board_profile = "C3MINI";
|
settings.board_profile = "C3MINI";
|
||||||
#elif CONFIG_IDF_TARGET_ESP32S2
|
#elif CONFIG_IDF_TARGET_ESP32S2
|
||||||
settings.board_profile = "S2MINI";
|
settings.board_profile = "S2MINI";
|
||||||
#elif CONFIG_IDF_TARGET_ESP32S3
|
#elif CONFIG_IDF_TARGET_ESP32S3
|
||||||
settings.board_profile = "S32S3"; // BBQKees Gateway S3
|
settings.board_profile = "S32S3"; // BBQKees Gateway S3
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// apply the new board profile setting
|
// apply the new board profile setting
|
||||||
@@ -194,8 +201,9 @@ StateUpdateResult WebSettings::update(JsonObject root, WebSettings & settings) {
|
|||||||
if (old_board_profile != settings.board_profile) {
|
if (old_board_profile != settings.board_profile) {
|
||||||
// see if need to override the set board profile (e.g. forced by NVS boot string)
|
// see if need to override the set board profile (e.g. forced by NVS boot string)
|
||||||
EMSESP::logger().info("Setting new Board profile %s (was %s)", settings.board_profile.c_str(), old_board_profile.c_str());
|
EMSESP::logger().info("Setting new Board profile %s (was %s)", settings.board_profile.c_str(), old_board_profile.c_str());
|
||||||
} else {
|
} else if (org_board_profile != settings.board_profile) {
|
||||||
EMSESP::logger().info("Board profile set to %s", settings.board_profile.c_str());
|
// EMSESP::logger().info("Board profile set to %s", settings.board_profile.c_str());
|
||||||
|
EMSESP::logger().info("Setting new Board profile %s (was %s)", settings.board_profile.c_str(), org_board_profile.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
int prev;
|
int prev;
|
||||||
@@ -229,6 +237,9 @@ StateUpdateResult WebSettings::update(JsonObject root, WebSettings & settings) {
|
|||||||
prev = settings.eth_clock_mode;
|
prev = settings.eth_clock_mode;
|
||||||
settings.eth_clock_mode = data[8];
|
settings.eth_clock_mode = data[8];
|
||||||
check_flag(prev, settings.eth_clock_mode, ChangeFlags::RESTART);
|
check_flag(prev, settings.eth_clock_mode, ChangeFlags::RESTART);
|
||||||
|
prev = settings.led_type;
|
||||||
|
settings.led_type = data[9];
|
||||||
|
check_flag(prev, settings.led_type, ChangeFlags::LED);
|
||||||
|
|
||||||
// tx_mode, rx and tx pins
|
// tx_mode, rx and tx pins
|
||||||
prev = settings.tx_mode;
|
prev = settings.tx_mode;
|
||||||
@@ -304,6 +315,7 @@ StateUpdateResult WebSettings::update(JsonObject root, WebSettings & settings) {
|
|||||||
settings.low_clock = root["low_clock"];
|
settings.low_clock = root["low_clock"];
|
||||||
check_flag(prev, settings.low_clock, ChangeFlags::RESTART);
|
check_flag(prev, settings.low_clock, ChangeFlags::RESTART);
|
||||||
|
|
||||||
|
// Modbus settings
|
||||||
prev = settings.modbus_enabled;
|
prev = settings.modbus_enabled;
|
||||||
settings.modbus_enabled = root["modbus_enabled"] | EMSESP_DEFAULT_MODBUS_ENABLED;
|
settings.modbus_enabled = root["modbus_enabled"] | EMSESP_DEFAULT_MODBUS_ENABLED;
|
||||||
check_flag(prev, settings.modbus_enabled, ChangeFlags::RESTART);
|
check_flag(prev, settings.modbus_enabled, ChangeFlags::RESTART);
|
||||||
@@ -455,6 +467,7 @@ void WebSettingsService::board_profile(AsyncWebServerRequest * request) {
|
|||||||
root["eth_power"] = data[6];
|
root["eth_power"] = data[6];
|
||||||
root["eth_phy_addr"] = data[7];
|
root["eth_phy_addr"] = data[7];
|
||||||
root["eth_clock_mode"] = data[8];
|
root["eth_clock_mode"] = data[8];
|
||||||
|
root["led_type"] = data[9];
|
||||||
|
|
||||||
response->setLength();
|
response->setLength();
|
||||||
request->send(response);
|
request->send(response);
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ class WebSettings {
|
|||||||
bool dallas_parasite;
|
bool dallas_parasite;
|
||||||
uint8_t led_gpio;
|
uint8_t led_gpio;
|
||||||
bool hide_led;
|
bool hide_led;
|
||||||
|
uint8_t led_type;
|
||||||
bool low_clock;
|
bool low_clock;
|
||||||
bool telnet_enabled;
|
bool telnet_enabled;
|
||||||
bool notoken_api;
|
bool notoken_api;
|
||||||
|
|||||||
Reference in New Issue
Block a user