updated gpio test logic

This commit is contained in:
proddy
2025-11-20 22:58:26 +01:00
parent c9bddba446
commit 23a660aabb
15 changed files with 1879 additions and 1870 deletions

View File

@@ -360,7 +360,7 @@ const Sensors = () => {
v: 0,
o: 0,
f: 1,
t: AnalogType.NOTUSED,
t: AnalogType.DIGITAL_IN, // default to digital in 1
d: false,
s: false,
o_n: ''
@@ -462,7 +462,7 @@ const Sensors = () => {
>
<Cell stiff>{as.g}</Cell>
<Cell>{as.n}</Cell>
<Cell stiff>{AnalogTypeNames[as.t]} </Cell>
<Cell stiff>{AnalogTypeNames[as.t - 1]} </Cell>
{(as.t === AnalogType.DIGITAL_OUT &&
as.g !== GPIO_25 &&
as.g !== GPIO_26) ||
@@ -470,9 +470,7 @@ const Sensors = () => {
as.t === AnalogType.PULSE ? (
<Cell stiff>{as.v ? LL.ON() : LL.OFF()}</Cell>
) : (
<Cell stiff>
{as.t !== AnalogType.NOTUSED ? formatValue(as.v, as.u) : ''}
</Cell>
<Cell stiff>{formatValue(as.v, as.u)}</Cell>
)}
</Row>
))}

View File

@@ -98,7 +98,7 @@ const SensorsAnalogDialog = ({
const analogTypeMenuItems = useMemo(
() =>
AnalogTypeNames.map((val, i) => (
<MenuItem key={val} value={i}>
<MenuItem key={val} value={i + 1}>
{val}
</MenuItem>
)),

View File

@@ -231,7 +231,6 @@ export const DeviceValueUOM_s = [
export enum AnalogType {
REMOVED = -1,
NOTUSED = 0,
DIGITAL_IN = 1,
COUNTER = 2,
ADC = 3,
@@ -250,22 +249,21 @@ export enum AnalogType {
}
export const AnalogTypeNames = [
'(disabled)',
'Digital In',
'Counter',
'ADC In',
'Timer',
'Rate',
'Digital Out',
'PWM 0',
'PWM 1',
'PWM 2',
'NTC Temp.',
'RGB Led',
'Pulse',
'Freq 0',
'Freq 1',
'Freq 2'
'Digital In', // 1
'Counter', // 2
'ADC In', // 3
'Timer', // 4
'Rate', // 5
'Digital Out', // 6
'PWM 0', // 7
'PWM 1', // 8
'PWM 2', // 9
'NTC Temp.', // 10
'RGB Led', // 11
'Pulse', // 12
'Freq 0', // 13
'Freq 1', // 14
'Freq 2', // 15
] as const;
export const BOARD_PROFILES = {