Skip to content

Commit fa141f0

Browse files
committed
fixed bug
1 parent 5a4256a commit fa141f0

1 file changed

Lines changed: 14 additions & 6 deletions

File tree

ExtIO_Hackrf/ExtIO_HackRF.cpp

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ clock_t time_start, time_now;
6060
uint32_t byte_count = 0;
6161

6262
typedef long clock_t;
63-
static hackrf_device *device;
63+
hackrf_device *device=nullptr;
6464
HWND h_dialog = NULL;
6565
int result;
6666
short *short_buf = nullptr;
@@ -171,7 +171,9 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR
171171
SendDlgItemMessage(hwndDlg, IDC_LNA, TBM_SETTIC, FALSE, i);
172172
}
173173
SendDlgItemMessage(hwndDlg, IDC_LNA, TBM_SETPOS, TRUE, (int)lna_gain);
174-
174+
_itow_s(lna_gain, str, 10, 10);
175+
wcscat(str, TEXT(" dB"));
176+
Static_SetText(GetDlgItem(hwndDlg, IDC_LNAVALUE), str);
175177

176178
SendDlgItemMessage(hwndDlg, IDC_VGA, TBM_SETRANGEMIN, FALSE, 0);
177179
SendDlgItemMessage(hwndDlg, IDC_VGA, TBM_SETRANGEMAX, FALSE, 62);
@@ -180,6 +182,9 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR
180182

181183
}
182184
SendDlgItemMessage(hwndDlg, IDC_VGA, TBM_SETPOS, TRUE, (int)vga_gain);
185+
_itow_s(vga_gain, str, 10, 10);
186+
wcscat(str, TEXT(" dB"));
187+
Static_SetText(GetDlgItem(hwndDlg, IDC_LNAVALUE), str);
183188

184189
Button_SetCheck(GetDlgItem(hwndDlg, IDC_AMP), amp ? BST_CHECKED : BST_UNCHECKED);
185190

@@ -205,7 +210,7 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR
205210
if (GetDlgItem(hwndDlg, IDC_VGA) == (HWND)lParam){
206211
if (LOWORD(wParam) != TB_THUMBTRACK && LOWORD(wParam) != TB_ENDTRACK)
207212
{
208-
if (vga_gain != (SendDlgItemMessage(hwndDlg, IDC_LNA, TBM_GETPOS, 0, NULL)& ~0x01)){
213+
if (vga_gain != (SendDlgItemMessage(hwndDlg, IDC_VGA, TBM_GETPOS, 0, NULL)& ~0x01)){
209214
vga_gain = SendDlgItemMessage(hwndDlg, IDC_VGA, TBM_GETPOS, 0, NULL)& ~0x01;
210215
_itow_s(vga_gain, str, 10, 10);
211216
wcscat(str, TEXT(" dB"));
@@ -666,15 +671,18 @@ void EXTIO_API ExtIoSetSetting(int idx, const char * value)
666671
}
667672
break;
668673
}
669-
case 1: {tempInt = atoi(value);
674+
case 1: {
675+
tempInt = atoi(value);
670676
lna_gain = tempInt& ~0x07;
671677
break;
672678
}
673-
case 2: {tempInt = atoi(value);
679+
case 2: {
680+
tempInt = atoi(value);
674681
vga_gain = tempInt& ~0x01;
675682
break;
676683
}
677-
case 3: {tempInt = atoi(value);
684+
case 3: {
685+
tempInt = atoi(value);
678686
amp = tempInt;
679687
break;
680688
}

0 commit comments

Comments
 (0)