[Update] Config Page: Device Tab. Threshold section. Add check volume button and remove dev component.
This commit is contained in:
@@ -42,7 +42,12 @@ export const useReceiveRoutes = () => {
|
||||
const { updateSendMessageButtonType } = useSendMessageButtonType();
|
||||
|
||||
|
||||
const { updateVolumeVariable_Mic, updateVolumeVariable_Speaker } = useVolume();
|
||||
const {
|
||||
updateVolumeVariable_Mic,
|
||||
updateVolumeVariable_Speaker,
|
||||
updateMicThresholdCheckStatus,
|
||||
updateSpeakerThresholdCheckStatus,
|
||||
} = useVolume();
|
||||
|
||||
const routes = {
|
||||
"/controller/callback_enable_translation": updateTranslationStatus,
|
||||
@@ -72,6 +77,10 @@ export const useReceiveRoutes = () => {
|
||||
|
||||
"/action/check_mic_threshold_energy": updateVolumeVariable_Mic,
|
||||
"/action/check_speaker_threshold_energy": updateVolumeVariable_Speaker,
|
||||
"/controller/callback_enable_check_mic_threshold": () => updateMicThresholdCheckStatus(true),
|
||||
"/controller/callback_disable_check_mic_threshold": () => updateMicThresholdCheckStatus(false),
|
||||
"/controller/callback_enable_check_speaker_threshold": () => updateSpeakerThresholdCheckStatus(true),
|
||||
"/controller/callback_disable_check_speaker_threshold": () => updateSpeakerThresholdCheckStatus(false),
|
||||
|
||||
"/config/enable_auto_clear_message_box": updateEnableAutoClearMessageBox,
|
||||
"/controller/callback_enable_auto_clear_chatbox": updateEnableAutoClearMessageBox,
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import {
|
||||
useStore_MicVolume,
|
||||
useStore_SpeakerVolume,
|
||||
useStore_MicThresholdCheckStatus,
|
||||
useStore_SpeakerThresholdCheckStatus,
|
||||
} from "@store";
|
||||
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
@@ -9,19 +11,38 @@ export const useVolume = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
const { updateMicVolume } = useStore_MicVolume();
|
||||
const { updateSpeakerVolume } = useStore_SpeakerVolume();
|
||||
const { currentMicThresholdCheckStatus, updateMicThresholdCheckStatus } = useStore_MicThresholdCheckStatus();
|
||||
const { currentSpeakerThresholdCheckStatus, updateSpeakerThresholdCheckStatus } = useStore_SpeakerThresholdCheckStatus();
|
||||
|
||||
const asyncPending = () => new Promise(() => {});
|
||||
return {
|
||||
volumeCheckStart_Mic: () => asyncStdoutToPython("/controller/callback_enable_check_mic_threshold"),
|
||||
volumeCheckStop_Mic: () => asyncStdoutToPython("/controller/callback_disable_check_mic_threshold"),
|
||||
volumeCheckStart_Mic: () => {
|
||||
updateMicThresholdCheckStatus(asyncPending);
|
||||
asyncStdoutToPython("/controller/callback_enable_check_mic_threshold");
|
||||
},
|
||||
volumeCheckStop_Mic: () => {
|
||||
updateMicThresholdCheckStatus(asyncPending);
|
||||
asyncStdoutToPython("/controller/callback_disable_check_mic_threshold");
|
||||
},
|
||||
updateVolumeVariable_Mic: (payload) => {
|
||||
updateMicVolume(payload);
|
||||
},
|
||||
currentMicThresholdCheckStatus: currentMicThresholdCheckStatus,
|
||||
updateMicThresholdCheckStatus: (payload) => updateMicThresholdCheckStatus(payload),
|
||||
|
||||
volumeCheckStart_Speaker: () => asyncStdoutToPython("/controller/callback_enable_check_speaker_threshold"),
|
||||
volumeCheckStop_Speaker: () => asyncStdoutToPython("/controller/callback_disable_check_speaker_threshold"),
|
||||
volumeCheckStart_Speaker: () => {
|
||||
updateSpeakerThresholdCheckStatus(asyncPending);
|
||||
asyncStdoutToPython("/controller/callback_enable_check_speaker_threshold");
|
||||
},
|
||||
volumeCheckStop_Speaker: () => {
|
||||
updateSpeakerThresholdCheckStatus(asyncPending);
|
||||
asyncStdoutToPython("/controller/callback_disable_check_speaker_threshold");
|
||||
},
|
||||
updateVolumeVariable_Speaker: (payload) => {
|
||||
updateSpeakerVolume(payload);
|
||||
},
|
||||
currentSpeakerThresholdCheckStatus: currentSpeakerThresholdCheckStatus,
|
||||
updateSpeakerThresholdCheckStatus: (payload) => updateSpeakerThresholdCheckStatus(payload),
|
||||
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user