Просмотр исходного кода

解决的问题是,设备发来曝光模式变化信息后,本地能够正常处理,并反应到ui

sw 4 дней назад
Родитель
Сommit
2338ff4e48
2 измененных файлов с 10 добавлено и 1 удалено
  1. 1 1
      src/domain/exam/paraSettingCoordinator.ts
  2. 9 0
      src/domain/mqttServiceForDevice.ts

+ 1 - 1
src/domain/exam/paraSettingCoordinator.ts

@@ -124,7 +124,7 @@ class ParaSettingCoordinator {
 
   handleNewExposureMode(newValue) {
     // 将数字转换为字符串: 0 -> 'time', 1 -> 'mAs'
-    const mode = newValue === 0 ? 'time' : 'mAs';
+    const mode = newValue === '0' ? 'time' : 'mAs';
     console.info('有新的曝光模式从设备端到来。handleNewExposureMode', newValue, '转换为:', mode);
     this.dispatch({
       type: setExposureModeThunk.fulfilled.type,

+ 9 - 0
src/domain/mqttServiceForDevice.ts

@@ -199,6 +199,15 @@ const startListening = () => {
       }
     });
 
+    mqttClient.subscribe(MQTT_TECHMODE, (err) => {
+      if (err) {
+        console.error(
+          '[mqttServiceForDevice] Failed to subscribe to topic MQTT_TECHMODE',
+          err
+        );
+      }
+    });
+
     mqttClient.subscribe(MQTT_ERRORLIST_NOTIFY, (err) => {
       if (err) {
         console.error(