analogsensors pulse output #2624 and frequncy input #2631

This commit is contained in:
MichaelDvP
2025-09-26 08:47:31 +02:00
parent b1d6ab3c96
commit 4cfcba18ee
9 changed files with 159 additions and 26 deletions

View File

@@ -439,7 +439,8 @@ const Sensors = () => {
<Cell>{a.n}</Cell>
<Cell stiff>{AnalogTypeNames[a.t]} </Cell>
{(a.t === AnalogType.DIGITAL_OUT && a.g !== 25 && a.g !== 26) ||
a.t === AnalogType.DIGITAL_IN ? (
a.t === AnalogType.DIGITAL_IN ||
a.t === AnalogType.PULSE ? (
<Cell stiff>{a.v ? LL.ON() : LL.OFF()}</Cell>
) : (
<Cell stiff>{a.t ? formatValue(a.v, a.u) : ''}</Cell>

View File

@@ -132,7 +132,9 @@ const SensorsAnalogDialog = ({
))}
</TextField>
</Grid>
{editItem.t >= AnalogType.COUNTER && editItem.t <= AnalogType.RATE && (
{((editItem.t >= AnalogType.COUNTER && editItem.t <= AnalogType.RATE) ||
(editItem.t >= AnalogType.FREQ_0 &&
editItem.t <= AnalogType.FREQ_2)) && (
<Grid>
<TextField
name="u"
@@ -348,6 +350,42 @@ const SensorsAnalogDialog = ({
</Grid>
</>
)}
{editItem.t === AnalogType.PULSE && (
<>
<Grid>
<TextField
name="o"
label={LL.POLARITY()}
value={editItem.o}
sx={{ width: '11ch' }}
select
onChange={updateFormValue}
>
<MenuItem value={0}>{LL.ACTIVEHIGH()}</MenuItem>
<MenuItem value={1}>{LL.ACTIVELOW()}</MenuItem>
</TextField>
</Grid>
<Grid>
<TextField
name="f"
label="Pulse"
value={numberValue(editItem.f)}
type="number"
sx={{ width: '15ch' }}
variant="outlined"
onChange={updateFormValue}
slotProps={{
input: {
startAdornment: (
<InputAdornment position="start">s</InputAdornment>
)
},
htmlInput: { min: '0', max: '10000', step: '0.1' }
}}
/>
</Grid>
</>
)}
</Grid>
</DialogContent>
<DialogActions>

View File

@@ -188,7 +188,8 @@ export enum DeviceValueUOM {
VOLTS,
MBAR,
LH,
CTKWH
CTKWH,
HZ
}
export const DeviceValueUOM_s = [
@@ -218,7 +219,8 @@ export const DeviceValueUOM_s = [
'V',
'mbar',
'l/h',
'ct/kWh'
'ct/kWh',
'Hz'
];
export enum AnalogType {
@@ -234,7 +236,11 @@ export enum AnalogType {
PWM_1 = 8,
PWM_2 = 9,
NTC = 10,
RGB = 11
RGB = 11,
PULSE = 12,
FREQ_0 = 13,
FREQ_1 = 14,
FREQ_2 = 15
}
export const AnalogTypeNames = [
@@ -249,7 +255,11 @@ export const AnalogTypeNames = [
'PWM 1',
'PWM 2',
'NTC Temp.',
'RGB Led'
'RGB Led',
'Pulse',
'Freq 0',
'Freq 1',
'Freq 2'
];
type BoardProfiles = Record<string, string>;