Skip to content

Commit

Permalink
fixed bug
Browse files Browse the repository at this point in the history
  • Loading branch information
jocover committed Nov 7, 2015
1 parent 5a4256a commit fa141f0
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions ExtIO_Hackrf/ExtIO_HackRF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ clock_t time_start, time_now;
uint32_t byte_count = 0;

typedef long clock_t;
static hackrf_device *device;
hackrf_device *device=nullptr;
HWND h_dialog = NULL;
int result;
short *short_buf = nullptr;
Expand Down Expand Up @@ -171,7 +171,9 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR
SendDlgItemMessage(hwndDlg, IDC_LNA, TBM_SETTIC, FALSE, i);
}
SendDlgItemMessage(hwndDlg, IDC_LNA, TBM_SETPOS, TRUE, (int)lna_gain);

_itow_s(lna_gain, str, 10, 10);
wcscat(str, TEXT(" dB"));
Static_SetText(GetDlgItem(hwndDlg, IDC_LNAVALUE), str);

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

}
SendDlgItemMessage(hwndDlg, IDC_VGA, TBM_SETPOS, TRUE, (int)vga_gain);
_itow_s(vga_gain, str, 10, 10);
wcscat(str, TEXT(" dB"));
Static_SetText(GetDlgItem(hwndDlg, IDC_LNAVALUE), str);

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

Expand All @@ -205,7 +210,7 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR
if (GetDlgItem(hwndDlg, IDC_VGA) == (HWND)lParam){
if (LOWORD(wParam) != TB_THUMBTRACK && LOWORD(wParam) != TB_ENDTRACK)
{
if (vga_gain != (SendDlgItemMessage(hwndDlg, IDC_LNA, TBM_GETPOS, 0, NULL)& ~0x01)){
if (vga_gain != (SendDlgItemMessage(hwndDlg, IDC_VGA, TBM_GETPOS, 0, NULL)& ~0x01)){
vga_gain = SendDlgItemMessage(hwndDlg, IDC_VGA, TBM_GETPOS, 0, NULL)& ~0x01;
_itow_s(vga_gain, str, 10, 10);
wcscat(str, TEXT(" dB"));
Expand Down Expand Up @@ -666,15 +671,18 @@ void EXTIO_API ExtIoSetSetting(int idx, const char * value)
}
break;
}
case 1: {tempInt = atoi(value);
case 1: {
tempInt = atoi(value);
lna_gain = tempInt& ~0x07;
break;
}
case 2: {tempInt = atoi(value);
case 2: {
tempInt = atoi(value);
vga_gain = tempInt& ~0x01;
break;
}
case 3: {tempInt = atoi(value);
case 3: {
tempInt = atoi(value);
amp = tempInt;
break;
}
Expand Down

0 comments on commit fa141f0

Please sign in to comment.