Merge pull request #1941 from proddy/dev

correct firmware naming #1933
This commit is contained in:
Proddy
2024-08-16 20:03:09 +02:00
committed by GitHub
38 changed files with 275 additions and 255 deletions

View File

@@ -38,15 +38,9 @@ jobs:
sed -i "s/= 'pl'/= 'en'/" ./src/i18n/i18n-util.ts
yarn build
yarn webUI
- name: Build ESP32 4M firmware
- name: Build all target environments from default_envs
run: |
platformio run -e ci
- name: Build ESP32-S3 16M firmware
run: |
platformio run -e ci_s3
- name: Build ESP32 16M firmware
run: |
platformio run -e ci_16M
platformio run
- name: Create GitHub Release
id: 'automatic_releases'
uses: 'marvinpinto/action-automatic-releases@latest'

View File

@@ -35,16 +35,10 @@ jobs:
sed -i "s/= 'pl'/= 'en'/" ./src/i18n/i18n-util.ts
yarn build
yarn webUI
- name: Build ESP32 4M firmware
- name: Build all target environments from default_envs
run: |
platformio run -e ci
- name: Build ESP32-S3 16M firmware
run: |
platformio run -e ci_s3
- name: Build ESP32 16M firmware
run: |
platformio run -e ci_16M
- name: Release
platformio run
- name: Create GitHub Release
uses: 'marvinpinto/action-automatic-releases@latest'
with:
repo_token: '${{ secrets.GITHUB_TOKEN }}'

View File

@@ -38,16 +38,10 @@ jobs:
sed -i "s/= 'pl'/= 'en'/" ./src/i18n/i18n-util.ts
yarn build
yarn webUI
- name: Build ESP32 4M firmware
- name: Build all target environments from default_envs
run: |
platformio run -e ci
- name: Build ESP32-S3 16M firmware
run: |
platformio run -e ci_s3
- name: Build ESP32 16M firmware
run: |
platformio run -e ci_16M
- name: Create a GH Release
platformio run
- name: Create GitHub Release
id: 'automatic_releases'
uses: 'marvinpinto/action-automatic-releases@latest'
with:

View File

@@ -55,3 +55,6 @@
- thermostat/remotetemp as command [#1835](https://github.com/emsesp/EMS-ESP32/discussions/1835)
- temperaturesensor id notation with underscore [#1794](https://github.com/emsesp/EMS-ESP32/discussions/1794)
- Change key-names in JSON to be compliant and consistent [#1860](https://github.com/emsesp/EMS-ESP32/issues/1860)
- Updates to webUI [#1920](https://github.com/emsesp/EMS-ESP32/issues/1920)
- Correct firmware naming #1933 [#1933](https://github.com/emsesp/EMS-ESP32/issues/1933)

View File

@@ -35,7 +35,7 @@
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-icons": "^5.3.0",
"react-router-dom": "^6.26.0",
"react-router-dom": "^6.26.1",
"react-toastify": "^10.0.5",
"typesafe-i18n": "^5.26.2",
"typescript": "^5.5.4"

View File

@@ -1,4 +1,4 @@
import { useCallback, useState } from 'react';
import { useCallback, useEffect, useState } from 'react';
import { useBlocker } from 'react-router-dom';
import { toast } from 'react-toastify';
@@ -18,7 +18,7 @@ import {
Table
} from '@table-library/react-table-library/table';
import { useTheme } from '@table-library/react-table-library/theme';
import { updateState, useAutoRequest, useRequest } from 'alova/client';
import { updateState, useRequest } from 'alova/client';
import {
BlockNavigation,
ButtonRow,
@@ -48,9 +48,20 @@ const CustomEntities = () => {
data: entities,
send: fetchEntities,
error
} = useAutoRequest(readCustomEntities, {
initialData: [],
pollingTime: 2000
} = useRequest(readCustomEntities, {
initialData: []
});
useEffect(() => {
const timer = setInterval(async () => {
if (dialogOpen) {
return;
}
await fetchEntities();
}, 2000);
return () => {
clearInterval(timer);
};
});
const { send: writeEntities } = useRequest(

View File

@@ -672,7 +672,7 @@ const Customizations = () => {
<>
{devices && renderDeviceList()}
{selectedDevice !== -1 && !rename && renderDeviceData()}
{restartNeeded && (
{restartNeeded ? (
<MessageBox my={2} level="warning" message={LL.RESTART_TEXT(0)}>
<Button
startIcon={<PowerSettingsNewIcon />}
@@ -683,8 +683,7 @@ const Customizations = () => {
{LL.RESTART()}
</Button>
</MessageBox>
)}
{!restartNeeded && (
) : (
<Box display="flex" flexWrap="wrap">
<Box flexGrow={1}>
{numChanges !== 0 && (

View File

@@ -136,30 +136,7 @@ export const createSettingsValidator = (settings: Settings) =>
rx_gpio: [{ required: true, message: 'Rx GPIO is required' }, GPIO_VALIDATOR]
}),
...(settings.board_profile === 'CUSTOM' &&
settings.platform === 'ESP32R' && {
led_gpio: [
{ required: true, message: 'LED GPIO is required' },
GPIO_VALIDATORR
],
dallas_gpio: [
{ required: true, message: 'GPIO is required' },
GPIO_VALIDATORR
],
pbutton_gpio: [
{ required: true, message: 'Button GPIO is required' },
GPIO_VALIDATORR
],
tx_gpio: [
{ required: true, message: 'Tx GPIO is required' },
GPIO_VALIDATORR
],
rx_gpio: [
{ required: true, message: 'Rx GPIO is required' },
GPIO_VALIDATORR
]
}),
...(settings.board_profile === 'CUSTOM' &&
settings.platform === 'ESP32-C3' && {
settings.platform === 'ESP32C3' && {
led_gpio: [
{ required: true, message: 'LED GPIO is required' },
GPIO_VALIDATORC3
@@ -182,7 +159,7 @@ export const createSettingsValidator = (settings: Settings) =>
]
}),
...(settings.board_profile === 'CUSTOM' &&
settings.platform === 'ESP32-S2' && {
settings.platform === 'ESP32S2' && {
led_gpio: [
{ required: true, message: 'LED GPIO is required' },
GPIO_VALIDATORS2
@@ -205,7 +182,7 @@ export const createSettingsValidator = (settings: Settings) =>
]
}),
...(settings.board_profile === 'CUSTOM' &&
settings.platform === 'ESP32-S3' && {
settings.platform === 'ESP32S3' && {
led_gpio: [
{ required: true, message: 'LED GPIO is required' },
GPIO_VALIDATORS3
@@ -487,15 +464,13 @@ export const analogSensorItemValidation = (
],
g: [
{ required: true, message: 'GPIO is required' },
platform === 'ESP32-S3'
platform === 'ESP32S3'
? GPIO_VALIDATORS3
: platform === 'ESP32-S2'
: platform === 'ESP32S2'
? GPIO_VALIDATORS2
: platform === 'ESP32-C3'
: platform === 'ESP32C3'
? GPIO_VALIDATORC3
: platform === 'ESP32R'
? GPIO_VALIDATORR
: GPIO_VALIDATOR,
: GPIO_VALIDATOR,
...(creating ? [isGPIOUniqueValidator(sensors)] : [])
]
});

View File

@@ -712,7 +712,7 @@ const ApplicationSettings = () => {
/>
<Typography sx={{ pb: 1, pt: 2 }} variant="h6" color="primary">
{LL.GENERAL_OPTIONS()}
{LL.SPECIAL_FUNCTIONS()}
</Typography>
<BlockFormControlLabel
control={

View File

@@ -1,6 +1,8 @@
import { useState } from 'react';
import { toast } from 'react-toastify';
import DownloadIcon from '@mui/icons-material/GetApp';
import PowerSettingsNewIcon from '@mui/icons-material/PowerSettingsNew';
import { Box, Button, Divider, Link, Typography } from '@mui/material';
import * as SystemApi from 'api/system';
@@ -15,8 +17,10 @@ import { getDevVersion, getStableVersion } from 'api/system';
import { useRequest } from 'alova/client';
import type { APIcall } from 'app/main/types';
import RestartMonitor from 'app/status/RestartMonitor';
import {
FormLoader,
MessageBox,
SectionContent,
SingleUpload,
useLayoutTitle
@@ -26,6 +30,9 @@ import { useI18nContext } from 'i18n/i18n-react';
const DownloadUpload = () => {
const { LL } = useI18nContext();
const [restarting, setRestarting] = useState<boolean>(false);
const [restartNeeded, setRestartNeeded] = useState<boolean>(false);
const { send: sendSettings } = useRequest(getSettings(), {
immediate: false
}).onSuccess((event) => {
@@ -41,7 +48,7 @@ const DownloadUpload = () => {
const { send: sendEntities } = useRequest(getEntities(), {
immediate: false
}).onSuccess((event) => {
saveFile(event.data, 'entities.json');
saveFile(event.data, 'custom_entities.json');
});
const { send: sendSchedule } = useRequest(getSchedule(), {
@@ -65,13 +72,29 @@ const DownloadUpload = () => {
error
} = useRequest(SystemApi.readHardwareStatus);
const { send: restartCommand } = useRequest(SystemApi.restart(), {
immediate: false
});
const restart = async () => {
await restartCommand()
.then(() => {
setRestarting(true);
})
.catch((error: Error) => {
toast.error(error.message);
});
};
// called immediately to get the latest version, on page load
// set immediate to false to avoid calling the API on page load and GH blocking while testing!
const { data: latestVersion } = useRequest(getStableVersion, {
immediate: true
// immediate: false
});
const { data: latestDevVersion } = useRequest(getDevVersion, {
immediate: true
// immediate: false
});
const STABLE_URL = 'https://github.com/emsesp/EMS-ESP32/releases/download/';
@@ -83,31 +106,23 @@ const DownloadUpload = () => {
'https://github.com/emsesp/EMS-ESP32/blob/dev/CHANGELOG_LATEST.md';
const getBinURL = (v: string) =>
'EMS-ESP-' +
v.replaceAll('.', '_') +
'-' +
getPlatform().replaceAll('-', '_') +
'.bin';
'EMS-ESP-' + v.replaceAll('.', '_') + '-' + getPlatform() + '.bin';
const getPlatform = () => {
if (
data.flash_chip_size >= 16384 &&
data.esp_platform === 'ESP32' &&
data.psram
) {
return data.esp_platform + '-16M';
}
return data.esp_platform;
return (
[data.esp_platform, data.flash_chip_size >= 16384 ? '16MB' : '4MB'].join('-') +
(data.psram ? '+' : '')
);
};
const saveFile = (json: unknown, endpoint: string) => {
const saveFile = (json: unknown, filename: string) => {
const anchor = document.createElement('a');
anchor.href = URL.createObjectURL(
new Blob([JSON.stringify(json, null, 2)], {
type: 'text/plain'
})
);
anchor.download = 'emsesp_' + endpoint;
anchor.download = 'emsesp_' + filename;
anchor.click();
URL.revokeObjectURL(anchor.href);
toast.info(LL.DOWNLOAD_SUCCESSFUL());
@@ -284,12 +299,27 @@ const DownloadUpload = () => {
)}
</Box>
<SingleUpload />
<SingleUpload setRestartNeeded={setRestartNeeded} />
{restartNeeded && (
<MessageBox mt={2} level="warning" message={LL.RESTART_TEXT(0)}>
<Button
startIcon={<PowerSettingsNewIcon />}
variant="contained"
color="error"
onClick={restart}
>
{LL.RESTART()}
</Button>
</MessageBox>
)}
</>
);
};
return <SectionContent>{content()}</SectionContent>;
return (
<SectionContent>{restarting ? <RestartMonitor /> : content()}</SectionContent>
);
};
export default DownloadUpload;

View File

@@ -7,15 +7,16 @@ import { FormLoader } from 'components';
import { useI18nContext } from 'i18n/i18n-react';
const RESTART_TIMEOUT = 2 * 60 * 1000;
const POLL_INTERVAL = 3000;
const POLL_INTERVAL = 1000;
const RestartMonitor = () => {
const [failed, setFailed] = useState<boolean>(false);
const [timeoutId, setTimeoutId] = useState<NodeJS.Timeout>();
const { LL } = useI18nContext();
const { send } = useRequest(SystemApi.readSystemStatus);
const timeoutAt = useRef(new Date().getTime() + RESTART_TIMEOUT);
const { send } = useRequest(SystemApi.readSystemStatus);
const poll = useRef(async () => {
try {
await send();

View File

@@ -1,5 +1,4 @@
// Code inspired by https://medium.com/@dprincecoder/creating-a-drag-and-drop-file-upload-component-in-react-a-step-by-step-guide-4d93b6cc21e0
// (c) Prince Azubuike
// Code inspired by Prince Azubuike from https://medium.com/@dprincecoder/creating-a-drag-and-drop-file-upload-component-in-react-a-step-by-step-guide-4d93b6cc21e0
import { type ChangeEvent, useRef, useState } from 'react';
import CancelIcon from '@mui/icons-material/Cancel';

View File

@@ -2,23 +2,17 @@ import { useEffect, useState } from 'react';
import { toast } from 'react-toastify';
import CancelIcon from '@mui/icons-material/Cancel';
import PowerSettingsNewIcon from '@mui/icons-material/PowerSettingsNew';
import { Box, Button, LinearProgress, Typography } from '@mui/material';
import * as SystemApi from 'api/system';
import { useRequest } from 'alova/client';
import RestartMonitor from 'app/status/RestartMonitor';
import MessageBox from 'components/MessageBox';
import { useI18nContext } from 'i18n/i18n-react';
import DragNdrop from './DragNdrop';
const SingleUpload = () => {
const SingleUpload = ({ setRestartNeeded }) => {
const [md5, setMd5] = useState<string>();
const [restarting, setRestarting] = useState<boolean>(false);
const [restartNeeded, setRestartNeeded] = useState<boolean>(false);
const [file, setFile] = useState<File>();
const { LL } = useI18nContext();
@@ -39,17 +33,6 @@ const SingleUpload = () => {
}
});
const { send: restartCommand } = useRequest(SystemApi.restart(), {
immediate: false
});
const restart = async () => {
await restartCommand().catch((error: Error) => {
toast.error(error.message);
});
setRestarting(true);
};
useEffect(async () => {
if (file) {
console.log('going to upload file ', file.name);
@@ -75,7 +58,7 @@ const SingleUpload = () => {
<Typography variant="body2">{LL.UPLOAD_TEXT()}</Typography>
</Box>
{isUploading || restartNeeded ? (
{isUploading ? (
<>
<Box width="100%" p={2}>
<LinearProgress
@@ -90,17 +73,15 @@ const SingleUpload = () => {
/>
</Box>
{!restartNeeded && (
<Button
sx={{ ml: 2 }}
startIcon={<CancelIcon />}
variant="outlined"
color="error"
onClick={cancelUpload}
>
{LL.CANCEL()}
</Button>
)}
<Button
sx={{ ml: 2 }}
startIcon={<CancelIcon />}
variant="outlined"
color="error"
onClick={cancelUpload}
>
{LL.CANCEL()}
</Button>
</>
) : (
<DragNdrop onFileSelected={setFile} />
@@ -111,21 +92,6 @@ const SingleUpload = () => {
<Typography variant="body2">{'MD5: ' + md5}</Typography>
</Box>
)}
{restartNeeded && (
<MessageBox mt={2} level="warning" message={LL.RESTART_TEXT(0)}>
<Button
startIcon={<PowerSettingsNewIcon />}
variant="contained"
color="error"
onClick={restart}
>
{LL.RESTART()}
</Button>
</MessageBox>
)}
{restarting && <RestartMonitor />}
</>
);
};

View File

@@ -331,9 +331,10 @@ const de: Translation = {
RENAME: 'Umbenennen',
ENABLE_MODBUS: 'Modbus aktivieren',
VIEW_LOG: 'Sehen Sie sich das Protokoll an, um Probleme zu diagnostizieren',
UPLOAD_DRAG: 'Ziehen Sie eine Datei hierher oder klicken Sie, um eine auszuwählen', // TODO translate
SERVICES: 'Dienstleistungen', // TODO translate
ALLVALUES: 'Alle Werte' // TODO translate
UPLOAD_DRAG: 'Ziehen Sie eine Datei hierher oder klicken Sie, um eine auszuwählen',
SERVICES: 'Dienstleistungen',
ALLVALUES: 'Alle Werte',
SPECIAL_FUNCTIONS: 'Special Functions' // TODO translate
};
export default de;

View File

@@ -333,7 +333,8 @@ const en: Translation = {
VIEW_LOG: 'View log to diagnose issues',
UPLOAD_DRAG: 'drag and drop a file here or click to select one',
SERVICES: 'Services',
ALLVALUES: 'All Values'
ALLVALUES: 'All Values',
SPECIAL_FUNCTIONS: 'Special Functions'
};
export default en;

View File

@@ -333,7 +333,8 @@ const fr: Translation = {
VIEW_LOG: 'View log to diagnose issues', // TODO translate
UPLOAD_DRAG: 'drag and drop a file here or click to select one', // TODO translate
SERVICES: 'Services', // TODO translate
ALLVALUES: 'All Values' // TODO translate
ALLVALUES: 'All Values', // TODO translate
SPECIAL_FUNCTIONS: 'Special Functions' // TODO translate
};
export default fr;

View File

@@ -333,7 +333,8 @@ const it: Translation = {
VIEW_LOG: 'View log to diagnose issues', // TODO translate
UPLOAD_DRAG: 'drag and drop a file here or click to select one', // TODO translate
SERVICES: 'Services', // TODO translate
ALLVALUES: 'All Values' // TODO translate
ALLVALUES: 'All Values', // TODO translate
SPECIAL_FUNCTIONS: 'Special Functions' // TODO translate
};
export default it;

View File

@@ -333,7 +333,8 @@ const nl: Translation = {
VIEW_LOG: 'View log to diagnose issues', // TODO translate
UPLOAD_DRAG: 'drag and drop a file here or click to select one', // TODO translate
SERVICES: 'Services', // TODO translate
ALLVALUES: 'All Values' // TODO translate
ALLVALUES: 'All Values', // TODO translate
SPECIAL_FUNCTIONS: 'Special Functions' // TODO translate
};
export default nl;

View File

@@ -333,7 +333,8 @@ const no: Translation = {
VIEW_LOG: 'View log to diagnose issues', // TODO translate
UPLOAD_DRAG: 'drag and drop a file here or click to select one', // TODO translate
SERVICES: 'Services', // TODO translate
ALLVALUES: 'All Values' // TODO translate
ALLVALUES: 'All Values', // TODO translate
SPECIAL_FUNCTIONS: 'Special Functions' // TODO translate
};
export default no;

View File

@@ -333,7 +333,8 @@ const pl: BaseTranslation = {
VIEW_LOG: 'View log to diagnose issues', // TODO translate
UPLOAD_DRAG: 'drag and drop a file here or click to select one', // TODO translate
SERVICES: 'Services', // TODO translate
ALLVALUES: 'All Values' // TODO translate
ALLVALUES: 'All Values', // TODO translate
SPECIAL_FUNCTIONS: 'Special Functions' // TODO translate
};
export default pl;

View File

@@ -333,7 +333,8 @@ const sk: Translation = {
VIEW_LOG: 'View log to diagnose issues', // TODO translate
UPLOAD_DRAG: 'drag and drop a file here or click to select one', // TODO translate
SERVICES: 'Services', // TODO translate
ALLVALUES: 'All Values' // TODO translate
ALLVALUES: 'All Values', // TODO translate
SPECIAL_FUNCTIONS: 'Special Functions' // TODO translate
};
export default sk;

View File

@@ -333,7 +333,8 @@ const sv: Translation = {
VIEW_LOG: 'View log to diagnose issues', // TODO translate
UPLOAD_DRAG: 'drag and drop a file here or click to select one', // TODO translate
SERVICES: 'Services', // TODO translate
ALLVALUES: 'All Values' // TODO translate
ALLVALUES: 'All Values', // TODO translate
SPECIAL_FUNCTIONS: 'Special Functions' // TODO translate
};
export default sv;

View File

@@ -333,7 +333,8 @@ const tr: Translation = {
VIEW_LOG: 'View log to diagnose issues', // TODO translate
UPLOAD_DRAG: 'drag and drop a file here or click to select one', // TODO translate
SERVICES: 'Services', // TODO translate
ALLVALUES: 'All Values' // TODO translate
ALLVALUES: 'All Values', // TODO translate
SPECIAL_FUNCTIONS: 'Special Functions' // TODO translate
};
export default tr;

View File

@@ -1,4 +1,4 @@
export interface Features {
version: string;
platform: string; // "ESP32-C3" "ESP32-S2" "ESP32-S3" "ESP32"
platform: string; // "ESP32C3" "ESP32S2" "ESP32S3" "ESP32"
}

View File

@@ -1104,10 +1104,10 @@ __metadata:
languageName: node
linkType: hard
"@remix-run/router@npm:1.19.0":
version: 1.19.0
resolution: "@remix-run/router@npm:1.19.0"
checksum: 10c0/8c1503a535035f43747fea063b027aa841690c19a6bd8b6251c53d3aab4d4cae89b0bd4809dc7ab69fdbe61897f43c2683b82fc4cdc5785f9166cf2ea60e5932
"@remix-run/router@npm:1.19.1":
version: 1.19.1
resolution: "@remix-run/router@npm:1.19.1"
checksum: 10c0/9101fc96646e5107b6b0ef248d4c93bd965590c37ac02d35bcc57d1902467db7fc6eeec0a1fb97d0ce5bc96fae58e75239555e44a983239a61badba18e82d3b8
languageName: node
linkType: hard
@@ -1694,7 +1694,7 @@ __metadata:
react: "npm:^18.3.1"
react-dom: "npm:^18.3.1"
react-icons: "npm:^5.3.0"
react-router-dom: "npm:^6.26.0"
react-router-dom: "npm:^6.26.1"
react-toastify: "npm:^10.0.5"
rollup-plugin-visualizer: "npm:^5.12.0"
terser: "npm:^5.31.6"
@@ -5794,27 +5794,27 @@ __metadata:
languageName: node
linkType: hard
"react-router-dom@npm:^6.26.0":
version: 6.26.0
resolution: "react-router-dom@npm:6.26.0"
"react-router-dom@npm:^6.26.1":
version: 6.26.1
resolution: "react-router-dom@npm:6.26.1"
dependencies:
"@remix-run/router": "npm:1.19.0"
react-router: "npm:6.26.0"
"@remix-run/router": "npm:1.19.1"
react-router: "npm:6.26.1"
peerDependencies:
react: ">=16.8"
react-dom: ">=16.8"
checksum: 10c0/f59a5b72b1dab6480f97f20fa49b601cb1366e6e1c8def7fd727ccbc4e8cf527f64f7aedd2889534de222dc86634a23e2ed108b99e5443e7b5401a4db104e611
checksum: 10c0/9d9d8ed54d1c95497c6fa35a6ab46992efeccf1cfc6f0f6089c6c9b040af3eae09568fbb80c690bae08051a955d92d7aa3a0e730f626eb69285114993d31d430
languageName: node
linkType: hard
"react-router@npm:6.26.0":
version: 6.26.0
resolution: "react-router@npm:6.26.0"
"react-router@npm:6.26.1":
version: 6.26.1
resolution: "react-router@npm:6.26.1"
dependencies:
"@remix-run/router": "npm:1.19.0"
"@remix-run/router": "npm:1.19.1"
peerDependencies:
react: ">=16.8"
checksum: 10c0/498b97cac077170096715609e65e0039b64e497612ed585b8d3b88733310d23e7ca76ce189b09b6fbc65ca8df1595ca20ccac05a84006803843dfa05107d9540
checksum: 10c0/463078e740462b42bb5ba8004448f33fc9e63778f432a4ed55c57b93c5b519e25fb17913ee8435b0fda33c6b9f75df8ef6fcb2c3a4f8db84fb546d202e29aa51
languageName: node
linkType: hard

View File

@@ -369,29 +369,27 @@ const GENERATE_TOKEN_ENDPOINT = REST_ENDPOINT_ROOT + 'generateToken';
const hardware_status = {
emsesp_version: '3.7-demo',
esp_platform: 'ESP32',
max_alloc_heap: 107,
esp_platform: 'ESP32S3',
cpu_type: 'ESP32-S3',
cpu_rev: 3,
cpu_rev: 0,
cpu_cores: 2,
cpu_freq_mhz: 240,
free_heap: 166,
arduino_version: 'ESP32 Arduino v2.0.16',
sdk_version: 'v4.4.7',
max_alloc_heap: 191,
free_heap: 211,
arduino_version: 'ESP32 Arduino v2.0.17',
sdk_version: 'v4.4.7-dirty',
partition: 'app0',
flash_chip_size: 4096,
flash_chip_speed: 40000000,
app_used: 1863,
app_free: 121,
flash_chip_size: 16384,
flash_chip_speed: 80000000,
app_used: 2258,
app_free: 3438,
fs_used: 24,
fs_free: 2024,
free_mem: 100,
psram: true,
// psram: false,
psram_size: 4093,
free_psram: 4074,
free_caps: 8376,
psram: 8189,
psram_size: 8189,
free_psram: 8166,
has_loader: true,
free_caps: 4204,
// model: ''
model: 'BBQKees Electronics EMS Gateway E32 V2 (E32 V2.0 P3/2024011)'
};
@@ -671,7 +669,7 @@ let settings = {
eth_power: 15,
eth_phy_addr: 0,
eth_clock_mode: 1,
platform: 'ESP32R',
platform: 'ESP32',
modbus_enabled: false,
modbus_port: 502,
modbus_max_clients: 10,

View File

@@ -16,13 +16,12 @@
; my_build_flags = -DEMSESP_DEBUG -DEMSESP_TEST -DEMSESP_PINGTEST
[platformio]
; default_envs = esp32_4M
; default_envs = esp32_16M
default_envs = lolin_s3
; default_envs = lolin_c3_mini
; default_envs = s_4M
; default_envs = s_16M_P ; BBQKees E32V2
; default_envs = s3_16M ; BBQKees S3
; default_envs = c3_mini_4M
; default_envs = native
; default_envs = debug
; default_envs = custom
[env]
; upload settings
@@ -31,7 +30,8 @@ default_envs = lolin_s3
; upload_port = /dev/ttyUSB*
; for OTA add scripts/upload.py to extra_scripts
upload_protocol = custom
custom_emsesp_ip = 10.10.10.175
; custom_emsesp_ip = 10.10.10.175
custom_emsesp_ip = 192.168.1.23
; custom_emsesp_ip = ems-esp.local
custom_username = admin
custom_password = admin
@@ -45,21 +45,21 @@ extra_scripts =
; pre:scripts/refresh_module_library_native.py
post:scripts/run_native.py
[env:lolin_s3]
[env:s3_16M]
extra_scripts =
pre:scripts/build_interface.py ; comment out if you don't want to re-build the WebUI each time
scripts/rename_fw.py
scripts/upload.py
[env:esp32_16M]
[env:s_16M_P]
extra_scripts =
pre:scripts/build_interface.py ; comment out if you don't want to re-build the WebUI each time
scripts/rename_fw.py
; scripts/upload.py
scripts/upload.py
[env:lolin_c3_mini]
[env:c3_mini_4M]
extra_scripts =
; pre:scripts/build_interface.py ; comment out if you don't want to re-build the WebUI each time
pre:scripts/build_interface.py ; comment out if you don't want to re-build the WebUI each time
scripts/rename_fw.py
scripts/upload.py

View File

@@ -1,12 +1,13 @@
; PlatformIO Project Configuration File for EMS-ESP
;
; override any settings with your own local ones in pio_local.ini (see example pio_local.ini_example)
; The firmware is renamed following this convention, and placed in the build/firmware folder:
; EMS-ESP32-<version>-<chip_type>-<flash_mem>[+ if PSRAM onboard].bin
; For example: EMS-ESP-3_7_0-dev_31-esp32-16MB+.bin
[platformio]
; default_envs = esp32_4M
default_envs = lolin_s3
; default_envs = esp32_16M
; default_envs = native
; default_envs = espressi32_v3
; build all the CI targets as default. Use pio_local.ini to override.
default_envs = ci_s_4M, ci_s_16M, ci_s_16M_P, ci_s3_16M_P
extra_configs =
factory_settings.ini
@@ -16,10 +17,9 @@ extra_configs =
core_build_flags = -std=gnu++2a -Isrc -Wno-type-limits -Wall -Wextra -Wno-unused-parameter -Wno-unused-variable -Wno-format
core_unbuild_flags = -std=gnu++11
; my_build_flags is set in pio_local.ini
my_build_flags =
; explanation on some custom settings:
; explanation on these custom settings:
; CONFIG_ASYNC_TCP_QUEUE - see https://github.com/emsesp/EMS-ESP32/issues/177
; CONFIG_ASYNC_TCP_STACK_SIZE - stack usage measured: ESP32: ~2.3K, ESP32S3: ~3.5k
; CONFIG_ASYNC_TCP_TASK_PRIORITY - default is 10, was 5 for EMS-ESP
@@ -81,18 +81,43 @@ lib_ldf_mode = chain+
lib_deps =
https://github.com/emsesp/EMS-ESP-Modules.git
;
; build for GitHub Actions CI
; the Web interface is built seperately, so is skipped in extra_scripts
[env:ci]
; 4MB using Tasmota (no SSL) - like BBQKees older S32
;
; the Web interface is built seperately during the GH Action so is skipped (not included in extra_scripts)
;
[env:ci_s_4M]
; 4MB ESP32 - using Tasmota - no SSL, no PSRAM - like the BBQKees older S32 models
extends = espressi32_base_tasmota
extra_scripts = scripts/rename_fw.py
board = esp32dev
board_build.partitions = esp32_partition_4M.csv
board_build.extra_flags = -DBOARD_HAS_PSRAM
build_flags =
${espressi32_base_tasmota.build_flags}
[env:ci_s3]
; 16MB ESP32-S3 - like BBQKees S3
[env:ci_s_16M]
; 16MB ESP32 - using Tasmota - no SSL, no PSRAM - like the BBQKees older S32 models
extends = espressi32_base_tasmota
extra_scripts = scripts/rename_fw.py
board = esp32dev
board_build.partitions = esp32_partition_16M.csv
build_flags =
${espressi32_base_tasmota.build_flags}
'-DEMSESP_DEFAULT_BOARD_PROFILE="S32"'
[env:ci_s_16M_P]
; 16MB ESP32 - with PSRAM - like BBQKees E32V2
extends = espressi32_base
extra_scripts = scripts/rename_fw.py
board = esp32dev
board_build.partitions = esp32_partition_16M.csv
board_build.extra_flags = -DBOARD_HAS_PSRAM
build_flags =
${espressi32_base.build_flags}
'-DEMSESP_DEFAULT_BOARD_PROFILE="E32V2"'
[env:ci_s3_16M_P]
; 16MB ESP32-S3 - with PSRAM - like BBQKees S3
extends = espressi32_base
extra_scripts = scripts/rename_fw.py
board = lolin_s3
@@ -104,20 +129,11 @@ build_flags =
${espressi32_base.build_flags}
'-DEMSESP_DEFAULT_BOARD_PROFILE="S32S3"'
[env:ci_16M]
; 16MB ESP32 with PSRAM - like BBQKees E32V2
extends = espressi32_base
extra_scripts = scripts/rename_fw.py
board = esp32dev
board_build.partitions = esp32_partition_16M.csv
board_build.extra_flags = -DBOARD_HAS_PSRAM
build_flags =
${espressi32_base.build_flags}
'-DEMSESP_DEFAULT_BOARD_PROFILE="E32V2"'
;
; Direct builds
;
[env:esp32_4M]
[env:s_4M]
extends = espressi32_base_tasmota
board = esp32dev
board_upload.flash_size = 4MB
@@ -125,20 +141,20 @@ board_build.partitions = esp32_partition_4M.csv
build_flags =
${espressi32_base_tasmota.build_flags}
[env:esp32_4Mplus]
[env:s_asym_4M]
extends = espressi32_base_tasmota
board = esp32dev
board_upload.flash_size = 4MB
board_build.partitions = esp32_asym_partition_4M.csv
[env:esp32_16M]
[env:s_16M_P]
extends = espressi32_base
board = esp32dev
board_build.extra_flags = -DBOARD_HAS_PSRAM
board_upload.flash_size = 16MB
board_build.partitions = esp32_partition_16M.csv
[env:lolin_c3_mini]
[env:c3_mini_4M]
extends = espressi32_base_tasmota
board = lolin_c3_mini
board_upload.flash_size = 4MB
@@ -149,7 +165,7 @@ build_flags =
; lolin C3 mini v1 needs special wifi init.
; https://www.wemos.cc/en/latest/c3/c3_mini_1_0_0.html#about-wifi
[env:lolin_c3_mini_v1]
[env:c3_miniv1_4M]
extends = espressi32_base_tasmota
board = lolin_c3_mini
board_upload.flash_size = 4MB
@@ -159,7 +175,7 @@ build_flags =
-DBOARD_C3_MINI_V1
'-DEMSESP_DEFAULT_BOARD_PROFILE="C3MINI"'
[env:lolin_s2_mini]
[env:s2_4M]
extends = espressi32_base_tasmota
board = lolin_s2_mini
board_upload.flash_size = 4MB
@@ -168,7 +184,7 @@ build_flags =
${espressi32_base_tasmota.build_flags}
'-DEMSESP_DEFAULT_BOARD_PROFILE="S2MINI"'
[env:lolin_s3]
[env:s3_16M]
extends = espressi32_base
board = lolin_s3
board_build.f_cpu = 240000000L
@@ -180,7 +196,7 @@ build_flags =
${espressi32_base.build_flags}
'-DEMSESP_DEFAULT_BOARD_PROFILE="S32S3"'
[env:esp32_s3_32M]
[env:s3_32M]
extends = espressi32_base
board = lolin_s3
board_build.f_cpu = 240000000L

View File

@@ -8,7 +8,7 @@ OUTPUT_DIR = "build{}".format(os.path.sep)
def bin_copy(source, target, env):
# get the build info
# get the application version from version.h
bag = {}
exprs = [(re.compile(r'^#define EMSESP_APP_VERSION\s+"(\S+)"'), 'app_version')]
with open('./src/version.h', 'r') as f:
@@ -19,27 +19,48 @@ def bin_copy(source, target, env):
bag[var] = m.group(1)
app_version = bag.get('app_version')
platform = "ESP32"
chip_target = env.get('PIOENV').upper()
# this breaks the CI so removed
# flash_size = env["PIOENV"].split('_')[1]
# print(env.Dump())
# my_flags = env.ParseFlags(env['BUILD_FLAGS'])
# defines = {k: v for (k, v) in my_flags.get("CPPDEFINES")}
# print(my_flags)
# print(my_flags.get("CPPDEFINES")
# get the chip type, in uppercase
mcu = env.get('BOARD_MCU').upper()
# alternatively take platform from the pio target
# platform = str(target[0]).split(os.path.sep)[2]
print("app version: " + app_version)
print("platform: " + platform)
print("chip_target: " + chip_target)
# work out the flash memory from the PIO env name (sloppy but works)
# unfortunately the board_upload.flash_size is not passed down
flash_mem = "4MB"
pio_env = env.get('PIOENV').upper()
parts = pio_env.split('_')
# if it ends with a _P skip (we use this to denote PSRAM)
if parts[-1].endswith("P"):
index = -2
else:
index = -1
# if doesn't have an M at the end
if parts[index].endswith("M"):
flash_mem = parts[index] + "B"
# print(env.Dump())
# my_flags = env.ParseFlags(env['BUILD_FLAGS'])
# defines = {k: v for (k, v) in my_flags.get("CPPDEFINES")}
# find if BOARD_HAS_PSRAM is in the cppdefines
cppdefines = env.get("CPPDEFINES")
if 'BOARD_HAS_PSRAM' in cppdefines:
psram = True
else:
psram = False
print("*********************************************")
print("EMS-ESP version: " + app_version)
print("Has PSRAM: "+str(psram))
print("mcu: "+str(mcu))
print("Flash Mem: " + flash_mem)
# convert . to _ so Windows doesn't complain
variant = "EMS-ESP-" + app_version.replace(".", "_") + "-" + chip_target.replace("CI","ESP32")
# Format is EMS-ESP-<version>-<mcu>-<flash> with + at the end if it has PSRAM
variant = "EMS-ESP-" + app_version.replace(".", "_") + "-" + mcu + "-" + flash_mem + ("+" if psram else "")
# check if output directories exist and create if necessary
if not os.path.isdir(OUTPUT_DIR):

View File

@@ -274,11 +274,11 @@ enum {
};
#if CONFIG_IDF_TARGET_ESP32C3
#define EMSESP_PLATFORM "ESP32-C3"
#define EMSESP_PLATFORM "ESP32C3"
#elif CONFIG_IDF_TARGET_ESP32S2
#define EMSESP_PLATFORM "ESP32-S2"
#define EMSESP_PLATFORM "ESP32S2"
#elif CONFIG_IDF_TARGET_ESP32S3
#define EMSESP_PLATFORM "ESP32-S3"
#define EMSESP_PLATFORM "ESP32S3"
#elif CONFIG_IDF_TARGET_ESP32 || EMSESP_STANDALONE
#define EMSESP_PLATFORM "ESP32"
#else

View File

@@ -4525,8 +4525,13 @@ void Thermostat::register_device_values_hc(std::shared_ptr<Thermostat::HeatingCi
register_device_value(tag, &hc->coolstart, DeviceValueType::UINT8, FL_(coolstart), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_coolstart), 20, 35);
register_device_value(tag, &hc->coolondelay, DeviceValueType::UINT8, FL_(coolondelay), DeviceValueUOM::HOURS, MAKE_CF_CB(set_coolondelay), 1, 48);
register_device_value(tag, &hc->cooloffdelay, DeviceValueType::UINT8, FL_(cooloffdelay), DeviceValueUOM::HOURS, MAKE_CF_CB(set_cooloffdelay), 1, 48);
register_device_value(
tag, &hc->switchProgMode, DeviceValueType::ENUM, FL_(enum_switchProgMode), FL_(switchProgMode), DeviceValueUOM::NONE, MAKE_CF_CB(set_switchProgMode));
register_device_value(tag,
&hc->switchProgMode,
DeviceValueType::ENUM,
FL_(enum_switchProgMode),
FL_(switchProgMode),
DeviceValueUOM::NONE,
MAKE_CF_CB(set_switchProgMode));
break;
case EMSdevice::EMS_DEVICE_FLAG_CRF:

View File

@@ -1834,7 +1834,7 @@ void EMSdevice::mqtt_ha_entity_config_create() {
#endif
}
}
#ifdef EMSESP_DEBUG
#if defined(EMSESP_DEBUG) || defined(EMSESP_STANDALONE)
if (count) {
EMSESP::logger().debug("Created %d HA-%s-configs", count, device_type_name());
}

View File

@@ -215,7 +215,7 @@ class EMSdevice {
char * show_telegram_handlers(char * result, const size_t len, const uint8_t handlers);
void show_mqtt_handlers(uuid::console::Shell & shell) const;
// void list_device_entries(JsonObject output) const;
void add_handlers_ignored(const uint16_t handler);
void add_handlers_ignored(const uint16_t handler);
void set_climate_minmax(int8_t tag, int16_t min, uint32_t max);
void setCustomizationEntity(const std::string & entity_id);

View File

@@ -1538,7 +1538,9 @@ EMSESP::EMSESP()
// start all the core services
// the services must be loaded in the correct order
void EMSESP::start() {
#ifndef EMSESP_STANDALONE
system_.PSram(ESP.getPsramSize());
#endif
// don't need shell if running unit tests
#ifndef EMSESP_UNITY
// Serial console's shell

View File

@@ -379,7 +379,9 @@ std::string Helpers::data_to_hex(const uint8_t * data, const uint8_t length) {
return "<empty>";
}
char str[length * 3] = {0};
char str[length * 3];
memset(str, 0, length * sizeof(char));
char buffer[4];
char * p = &str[0];
for (uint8_t i = 0; i < length; i++) {

View File

@@ -142,8 +142,7 @@ void WebDataService::sensor_data(AsyncWebServerRequest * request) {
}
root["analog_enabled"] = EMSESP::analog_enabled();
String platform = EMSESP_PLATFORM;
root["platform"] = (platform == "ESP32" && EMSESP::system_.PSram()) ? "ESP32R" : platform;
root["platform"] = EMSESP_PLATFORM;
response->setLength();
request->send(response);

View File

@@ -75,8 +75,7 @@ void WebSettings::read(WebSettings & settings, JsonObject root) {
root["eth_power"] = settings.eth_power;
root["eth_phy_addr"] = settings.eth_phy_addr;
root["eth_clock_mode"] = settings.eth_clock_mode;
String platform = EMSESP_PLATFORM;
root["platform"] = (platform == "ESP32" && EMSESP::system_.PSram()) ? "ESP32R" : platform;
root["platform"] = EMSESP_PLATFORM;
root["modbus_enabled"] = settings.modbus_enabled;
root["modbus_port"] = settings.modbus_port;
root["modbus_max_clients"] = settings.modbus_max_clients;

View File

@@ -46,7 +46,7 @@ void WebStatusService::systemStatus(AsyncWebServerRequest * request) {
#endif
#endif
root["esp_platform"] = EMSESP_PLATFORM; // from default_settings.h: ESP32, ESP32-C3, ESP32-S2, ESP32-S3
root["esp_platform"] = EMSESP_PLATFORM; // from default_settings.h: ESP32, ESP32C3, ESP32S2, ESP32S3
root["status"] = EMSESP::bus_status(); // 0, 1 or 2
root["bus_uptime"] = EMSbus::bus_uptime();
root["num_devices"] = EMSESP::count_devices();
@@ -81,6 +81,7 @@ void WebStatusService::systemStatus(AsyncWebServerRequest * request) {
#endif
}
#ifndef EMSESP_STANDALONE
const esp_partition_t * partition = esp_partition_find_first(ESP_PARTITION_TYPE_APP, ESP_PARTITION_SUBTYPE_APP_FACTORY, nullptr);
root["has_loader"] = partition != NULL && partition != esp_ota_get_running_partition();
partition = esp_ota_get_next_update_partition(nullptr);
@@ -91,6 +92,7 @@ void WebStatusService::systemStatus(AsyncWebServerRequest * request) {
} else {
root["has_partition"] = false;
}
#endif
response->setLength();
request->send(response);