webapp: generalize battery serial interface settings

This commit is contained in:
Bernhard Kirchen 2024-09-13 23:53:40 +02:00 committed by Bernhard Kirchen
parent 7cd1984d60
commit 3b0c83fa25
4 changed files with 20 additions and 55 deletions

View File

@ -718,10 +718,10 @@
"MqttVoltageUnit": "Einheit", "MqttVoltageUnit": "Einheit",
"MqttSocTopic": "Topic für SoC", "MqttSocTopic": "Topic für SoC",
"MqttVoltageTopic": "Topic für Spannung", "MqttVoltageTopic": "Topic für Spannung",
"JkBmsConfiguration": "JK BMS Einstellungen", "SerialSettings": "Einstellungen Serielle Schnittstelle",
"JkBmsInterface": "Schnittstellentyp", "SerialInterfaceType": "Schnittstellentyp",
"JkBmsInterfaceUart": "TTL-UART an der MCU", "SerialInterfaceTypeUart": "TTL-UART an der MCU",
"JkBmsInterfaceTransceiver": "RS-485 Transceiver an der MCU", "SerialInterfaceTypeTransceiver": "RS-485 Transceiver an der MCU",
"JbdBmsConfiguration": "JBD BMS Einstellungen", "JbdBmsConfiguration": "JBD BMS Einstellungen",
"PollingInterval": "Abfrageintervall", "PollingInterval": "Abfrageintervall",
"Seconds": "@:base.Seconds", "Seconds": "@:base.Seconds",

View File

@ -721,10 +721,10 @@
"MqttVoltageUnit": "Unit", "MqttVoltageUnit": "Unit",
"MqttSocTopic": "SoC Value Topic", "MqttSocTopic": "SoC Value Topic",
"MqttVoltageTopic": "Voltage Value Topic", "MqttVoltageTopic": "Voltage Value Topic",
"JkBmsConfiguration": "JK BMS Settings", "SerialSettings": "Serial Settings",
"JkBmsInterface": "Interface Type", "SerialInterfaceType": "Interface Type",
"JkBmsInterfaceUart": "TTL-UART on MCU", "SerialInterfaceTypeUart": "TTL-UART on MCU",
"JkBmsInterfaceTransceiver": "RS-485 Transceiver on MCU", "SerialInterfaceTypeTransceiver": "RS-485 Transceiver on MCU",
"JbdBmsConfiguration": "JBD BMS Settings", "JbdBmsConfiguration": "JBD BMS Settings",
"PollingInterval": "Polling Interval", "PollingInterval": "Polling Interval",
"Seconds": "@:base.Seconds", "Seconds": "@:base.Seconds",

View File

@ -622,10 +622,10 @@
"MqttVoltageUnit": "Unit", "MqttVoltageUnit": "Unit",
"MqttSocTopic": "SoC Value Topic", "MqttSocTopic": "SoC Value Topic",
"MqttVoltageTopic": "Voltage Value Topic", "MqttVoltageTopic": "Voltage Value Topic",
"JkBmsConfiguration": "JK BMS Settings", "SerialSettings": "Serial Settings",
"JkBmsInterface": "Interface Type", "SerialInterfaceType": "Interface Type",
"JkBmsInterfaceUart": "TTL-UART on MCU", "SerialInterfaceTypeUart": "TTL-UART on MCU",
"JkBmsInterfaceTransceiver": "RS-485 Transceiver on MCU", "SerialInterfaceTypeTransceiver": "RS-485 Transceiver on MCU",
"JbdBmsConfiguration": "JBD BMS Settings", "JbdBmsConfiguration": "JBD BMS Settings",
"PollingInterval": "Polling Interval", "PollingInterval": "Polling Interval",
"Seconds": "@:base.Seconds", "Seconds": "@:base.Seconds",

View File

@ -37,58 +37,23 @@
</CardElement> </CardElement>
<CardElement <CardElement
v-if="batteryConfigList.enabled && batteryConfigList.provider == 1" v-if="batteryConfigList.enabled && (batteryConfigList.provider == 1 || batteryConfigList.provider == 6)"
:text="$t('batteryadmin.JkBmsConfiguration')" :text="$t('batteryadmin.SerialSettings')"
textVariant="text-bg-primary" textVariant="text-bg-primary"
addSpace addSpace
> >
<div class="row mb-3"> <div class="row mb-3">
<label class="col-sm-4 col-form-label"> <label class="col-sm-4 col-form-label">
{{ $t('batteryadmin.JkBmsInterface') }} {{ $t('batteryadmin.SerialInterfaceType') }}
</label> </label>
<div class="col-sm-8"> <div class="col-sm-8">
<select class="form-select" v-model="batteryConfigList.jkbms_interface"> <select class="form-select" v-model="batteryConfigList.jkbms_interface">
<option <option
v-for="jkBmsInterface in jkBmsInterfaceTypeList" v-for="serialInterface in serialBmsInterfaceTypeList"
:key="jkBmsInterface.key" :key="serialInterface.key"
:value="jkBmsInterface.key" :value="serialInterface.key"
> >
{{ $t(`batteryadmin.JkBmsInterface` + jkBmsInterface.value) }} {{ $t(`batteryadmin.SerialInterfaceType` + serialInterface.value) }}
</option>
</select>
</div>
</div>
<InputElement
:label="$t('batteryadmin.PollingInterval')"
v-model="batteryConfigList.jkbms_polling_interval"
type="number"
min="2"
max="90"
step="1"
:postfix="$t('batteryadmin.Seconds')"
wide
/>
</CardElement>
<CardElement
v-if="batteryConfigList.enabled && batteryConfigList.provider == 6"
:text="$t('batteryadmin.JbdBmsConfiguration')"
textVariant="text-bg-primary"
addSpace
>
<div class="row mb-3">
<label class="col-sm-4 col-form-label">
{{ $t('batteryadmin.JkBmsInterface') }}
</label>
<div class="col-sm-8">
<select class="form-select" v-model="batteryConfigList.jkbms_interface">
<option
v-for="jkBmsInterface in jkBmsInterfaceTypeList"
:key="jkBmsInterface.key"
:value="jkBmsInterface.key"
>
{{ $t(`batteryadmin.JkBmsInterface` + jkBmsInterface.value) }}
</option> </option>
</select> </select>
</div> </div>
@ -316,7 +281,7 @@ export default defineComponent({
{ key: 5, value: 'SBSCan' }, { key: 5, value: 'SBSCan' },
{ key: 6, value: 'JbdBmsSerial' }, { key: 6, value: 'JbdBmsSerial' },
], ],
jkBmsInterfaceTypeList: [ serialBmsInterfaceTypeList: [
{ key: 0, value: 'Uart' }, { key: 0, value: 'Uart' },
{ key: 1, value: 'Transceiver' }, { key: 1, value: 'Transceiver' },
], ],