Skip to content

Commit a6cfe46

Browse files
committed
Add Scanning Sound
1 parent f2fcab5 commit a6cfe46

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

bc_scanner_script.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,19 @@ struct BarCodeScript {
3333
bool is_file_end;
3434
};
3535

36+
static void scan_sound()
37+
{
38+
if(furi_hal_speaker_is_mine() || furi_hal_speaker_acquire(1000)) {
39+
float frequency = 4000;
40+
furi_hal_speaker_stop();
41+
furi_hal_speaker_set_volume(100);
42+
furi_hal_speaker_start(frequency, 100);
43+
furi_delay_ms(50);
44+
furi_hal_speaker_stop();
45+
furi_hal_speaker_release();
46+
}
47+
}
48+
3649

3750
static void usb_uart_serial_init() {
3851
furi_hal_usb_unlock();
@@ -126,7 +139,8 @@ static int32_t bc_scanner_worker(void* context){
126139
FURI_LOG_I(WORKER_TAG, "SendUART_MSG");
127140
bc_script->st.state = BarCodeStateRunning;
128141
bc_script->st.line_cur = 0;
129-
furi_delay_ms(500);
142+
furi_delay_ms(450);
143+
scan_sound();
130144
while(!bc_script->is_file_end){
131145
bc_script->st.state = BarCodeStateRunning;
132146
uint16_t size = bc_script_read_file(bc_script, script_file);

0 commit comments

Comments
 (0)