mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 16:29:51 +03:00
Merge branch 'dev' into dev
This commit is contained in:
@@ -32,7 +32,7 @@ import TimerIcon from '@mui/icons-material/Timer';
|
||||
import CancelIcon from '@mui/icons-material/Cancel';
|
||||
|
||||
import { ButtonRow, FormLoader, SectionContent, MessageBox } from '../../components';
|
||||
import { EspPlatform, SystemStatus, Version } from '../../types';
|
||||
import { SystemStatus, Version } from '../../types';
|
||||
import * as SystemApi from '../../api/system';
|
||||
import { extractErrorMessage, useRest } from '../../utils';
|
||||
|
||||
@@ -276,12 +276,11 @@ const SystemStatusForm: FC = () => {
|
||||
formatNumber(data.free_heap) +
|
||||
' KB / ' +
|
||||
formatNumber(data.max_alloc_heap) +
|
||||
' KB ' +
|
||||
(data.esp_platform === EspPlatform.ESP8266 ? '(' + data.heap_fragmentation + '% fragmentation)' : '')
|
||||
' KB '
|
||||
}
|
||||
/>
|
||||
</ListItem>
|
||||
{data.esp_platform === EspPlatform.ESP32 && data.psram_size !== undefined && data.free_psram !== undefined && (
|
||||
{data.psram_size !== undefined && data.free_psram !== undefined && (
|
||||
<>
|
||||
<Divider variant="inset" component="li" />
|
||||
<ListItem>
|
||||
@@ -306,9 +305,7 @@ const SystemStatusForm: FC = () => {
|
||||
</ListItemAvatar>
|
||||
<ListItemText
|
||||
primary={LL.FLASH()}
|
||||
secondary={
|
||||
formatNumber(data.flash_chip_size) + ' KB / ' + (data.flash_chip_speed / 1000000).toFixed(0) + ' MHz'
|
||||
}
|
||||
secondary={formatNumber(data.flash_chip_size) + ' KB / ' + (data.flash_chip_speed / 1000000).toFixed(0) + ' MHz'}
|
||||
/>
|
||||
</ListItem>
|
||||
<Divider variant="inset" component="li" />
|
||||
|
||||
@@ -124,18 +124,13 @@ const SettingsApplication: FC = () => {
|
||||
name="board_profile"
|
||||
label={LL.BOARD_PROFILE()}
|
||||
value={data.board_profile}
|
||||
disabled={processingBoard || data.board_profile === 'C3MINI'}
|
||||
disabled={processingBoard}
|
||||
variant="outlined"
|
||||
onChange={changeBoardProfile}
|
||||
margin="normal"
|
||||
select
|
||||
>
|
||||
{boardProfileSelectItems()}
|
||||
{data.board_profile === 'C3MINI' && (
|
||||
<MenuItem key={'C3MINI'} value={'C3MINI'}>
|
||||
C3 Mini
|
||||
</MenuItem>
|
||||
)}
|
||||
<Divider />
|
||||
<MenuItem key={'CUSTOM'} value={'CUSTOM'}>
|
||||
Custom…
|
||||
@@ -319,6 +314,7 @@ const SettingsApplication: FC = () => {
|
||||
<MenuItem value={0x0b}>Service Key (0x0B)</MenuItem>
|
||||
<MenuItem value={0x0d}>Modem (0x0D)</MenuItem>
|
||||
<MenuItem value={0x0a}>Terminal (0x0A)</MenuItem>
|
||||
<MenuItem value={0x0e}>Converter (0x0E)</MenuItem>
|
||||
<MenuItem value={0x0f}>Time Module (0x0F)</MenuItem>
|
||||
<MenuItem value={0x12}>Alarm Module (0x12)</MenuItem>
|
||||
</ValidatedTextField>
|
||||
|
||||
@@ -165,22 +165,12 @@ const SettingsCustomization: FC = () => {
|
||||
}
|
||||
|
||||
function formatName(de: DeviceEntity) {
|
||||
if (de.n === undefined) {
|
||||
return (
|
||||
<>
|
||||
(
|
||||
<Link target="_blank" href={APIURL + devices?.devices[selectedDevice].t + '/' + de.id}>
|
||||
{de.id}
|
||||
</Link>
|
||||
)
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
{de.n[0] === '!' ? LL.COMMAND() + ': ' + de.n.slice(1) : de.cn !== undefined && de.cn !== '' ? de.cn : de.n}
|
||||
(
|
||||
{de.n && (
|
||||
(de.n[0] === '!' ? LL.COMMAND() + ': ' + de.n.slice(1) : de.cn && de.cn !== '' ? de.cn : de.n) + ' '
|
||||
)}
|
||||
(
|
||||
<Link target="_blank" href={APIURL + devices?.devices[selectedDevice].t + '/' + de.id}>
|
||||
{de.id}
|
||||
</Link>
|
||||
|
||||
@@ -33,6 +33,7 @@ export interface Settings {
|
||||
eth_power: number;
|
||||
eth_phy_addr: number;
|
||||
eth_clock_mode: number;
|
||||
platform: string;
|
||||
}
|
||||
|
||||
export enum busConnectionStatus {
|
||||
@@ -242,7 +243,9 @@ export const BOARD_PROFILES: BoardProfiles = {
|
||||
'MH-ET': 'MH-ET Live D1 Mini',
|
||||
LOLIN: 'Lolin D32',
|
||||
OLIMEX: 'Olimex ESP32-EVB',
|
||||
OLIMEXPOE: 'Olimex ESP32-POE'
|
||||
OLIMEXPOE: 'Olimex ESP32-POE',
|
||||
C3MINI: 'Wemos C3 Mini',
|
||||
S2MINI: 'Wemos S2 Mini'
|
||||
};
|
||||
|
||||
export interface BoardProfileName {
|
||||
|
||||
@@ -12,7 +12,34 @@ export const GPIO_VALIDATOR = {
|
||||
value === 20 ||
|
||||
value === 24 ||
|
||||
(value >= 28 && value <= 31) ||
|
||||
value > 40)
|
||||
value > 40 ||
|
||||
value < 0)
|
||||
) {
|
||||
callback('Must be an valid GPIO port');
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const GPIO_VALIDATORC3 = {
|
||||
validator(rule: InternalRuleItem, value: number, callback: (error?: string) => void) {
|
||||
if (
|
||||
value &&
|
||||
((value >= 11 && value <= 19) || value > 21 || value < 0)
|
||||
) {
|
||||
callback('Must be an valid GPIO port');
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const GPIO_VALIDATORS2 = {
|
||||
validator(rule: InternalRuleItem, value: number, callback: (error?: string) => void) {
|
||||
if (
|
||||
value &&
|
||||
((value >= 19 && value <= 20) || (value >= 22 && value <= 32) || value > 40 || value < 0)
|
||||
) {
|
||||
callback('Must be an valid GPIO port');
|
||||
} else {
|
||||
@@ -23,13 +50,27 @@ export const GPIO_VALIDATOR = {
|
||||
|
||||
export const createSettingsValidator = (settings: Settings) =>
|
||||
new Schema({
|
||||
...(settings.board_profile === 'CUSTOM' && {
|
||||
...(settings.board_profile === 'CUSTOM' && settings.platform === 'ESP32' && {
|
||||
led_gpio: [{ required: true, message: 'LED GPIO is required' }, GPIO_VALIDATOR],
|
||||
dallas_gpio: [{ required: true, message: 'GPIO is required' }, GPIO_VALIDATOR],
|
||||
pbutton_gpio: [{ required: true, message: 'Button GPIO is required' }, GPIO_VALIDATOR],
|
||||
tx_gpio: [{ required: true, message: 'Tx GPIO is required' }, GPIO_VALIDATOR],
|
||||
rx_gpio: [{ required: true, message: 'Rx GPIO is required' }, GPIO_VALIDATOR]
|
||||
}),
|
||||
...(settings.board_profile === 'CUSTOM' && settings.platform === 'ESP32-C3' && {
|
||||
led_gpio: [{ required: true, message: 'LED GPIO is required' }, GPIO_VALIDATORC3],
|
||||
dallas_gpio: [{ required: true, message: 'GPIO is required' }, GPIO_VALIDATORC3],
|
||||
pbutton_gpio: [{ required: true, message: 'Button GPIO is required' }, GPIO_VALIDATORC3],
|
||||
tx_gpio: [{ required: true, message: 'Tx GPIO is required' }, GPIO_VALIDATORC3],
|
||||
rx_gpio: [{ required: true, message: 'Rx GPIO is required' }, GPIO_VALIDATORC3]
|
||||
}),
|
||||
...(settings.board_profile === 'CUSTOM' && settings.platform === 'ESP32-S2' && {
|
||||
led_gpio: [{ required: true, message: 'LED GPIO is required' }, GPIO_VALIDATORS2],
|
||||
dallas_gpio: [{ required: true, message: 'GPIO is required' }, GPIO_VALIDATORS2],
|
||||
pbutton_gpio: [{ required: true, message: 'Button GPIO is required' }, GPIO_VALIDATORS2],
|
||||
tx_gpio: [{ required: true, message: 'Tx GPIO is required' }, GPIO_VALIDATORS2],
|
||||
rx_gpio: [{ required: true, message: 'Rx GPIO is required' }, GPIO_VALIDATORS2]
|
||||
}),
|
||||
...(settings.syslog_enabled && {
|
||||
syslog_host: [{ required: true, message: 'Host is required' }, IP_OR_HOSTNAME_VALIDATOR],
|
||||
syslog_port: [
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
export enum EspPlatform {
|
||||
ESP8266 = 'esp8266',
|
||||
ESP32 = 'esp32'
|
||||
}
|
||||
|
||||
interface ESPSystemStatus {
|
||||
export interface SystemStatus {
|
||||
emsesp_version: string;
|
||||
esp_platform: EspPlatform;
|
||||
esp_platform: string;
|
||||
max_alloc_heap: number;
|
||||
cpu_freq_mhz: number;
|
||||
free_heap: number;
|
||||
@@ -18,21 +13,10 @@ interface ESPSystemStatus {
|
||||
fs_free: number;
|
||||
uptime: string;
|
||||
free_mem: number;
|
||||
}
|
||||
|
||||
export interface ESP32SystemStatus extends ESPSystemStatus {
|
||||
esp_platform: EspPlatform.ESP32;
|
||||
psram_size?: number;
|
||||
free_psram?: number;
|
||||
}
|
||||
|
||||
export interface ESP8266SystemStatus extends ESPSystemStatus {
|
||||
esp_platform: EspPlatform.ESP8266;
|
||||
heap_fragmentation: number;
|
||||
}
|
||||
|
||||
export type SystemStatus = ESP8266SystemStatus | ESP32SystemStatus;
|
||||
|
||||
export interface OTASettings {
|
||||
enabled: boolean;
|
||||
port: number;
|
||||
|
||||
Reference in New Issue
Block a user