Merge branch 'feat-map65-integration' of bitbucket.org:k1jt/wsjtx into feat-map65-integration

This commit is contained in:
Joe Taylor 2021-04-10 07:40:43 -04:00
commit f65b7925a7
31 changed files with 461 additions and 2034 deletions

View File

@ -0,0 +1,47 @@
# - Try to find portaudio
#
# Once done, this will define:
#
# portaudio_FOUND - system has portaudio
# portaudio_INCLUDE_DIRS - the portaudio include directories
# portaudio_LIBRARIES - link these to use portaudio
# portaudio_LIBRARY_DIRS - required shared/dynamic libraries are here
#
# If portaudio_STATIC is TRUE then static linking will be assumed
#
include (LibFindMacros)
set (portaudio_LIBRARY_DIRS)
# pkg-config?
find_path (__portaudio_pc_path NAMES portaudio-2.0.pc
PATH_SUFFIXES lib/pkgconfig lib64/pkgconfig
)
if (__portaudio_pc_path)
set (__pc_path $ENV{PKG_CONFIG_PATH})
list (APPEND __pc_path "${__portaudio_pc_path}")
set (ENV{PKG_CONFIG_PATH} "${__pc_path}")
unset (__pc_path CACHE)
endif ()
unset (__portaudio_pc_path CACHE)
# Use pkg-config to get hints about paths, libs and, flags
unset (__pkg_config_checked_hamlib CACHE)
libfind_pkg_check_modules (PORTAUDIO portaudio-2.0)
if (portaudio_STATIC)
set (portaudio_PROCESS_INCLUDES PORTAUDIO_STATIC_INCLUDE_DIRS)
set (portaudio_PROCESS_LIBS PORTAUDIO_STATIC_LDFLAGS)
set (portaudio_LIBRARY_DIRS ${PORTAUDIO_STATIC_LIBRARY_DIRS})
else ()
set (portaudio_PROCESS_INCLUDES PORTAUDIO_INCLUDE_DIRS)
set (portaudio_PROCESS_LIBS PORTAUDIO_LDFLAGS)
set (portaudio_LIBRARY_DIRS ${PORTAUDIO_LIBRARY_DIRS})
endif ()
libfind_process (portaudio)
# Handle the QUIETLY and REQUIRED arguments and set PORTAUDIO_FOUND to
# TRUE if all listed variables are TRUE
include (FindPackageHandleStandardArgs)
find_package_handle_standard_args (portaudio DEFAULT_MSG portaudio_INCLUDE_DIRS portaudio_LIBRARIES portaudio_LIBRARY_DIRS)

View File

@ -0,0 +1,57 @@
# Findusb
# =======
#
# Find the usb library
#
# This will define the following variables::
#
# usb_FOUND - True if the system has the usb library
# usb_VERSION - The verion of the usb library which was found
#
# and the following imported targets::
#
# usb::usb - The libusb library
find_package (PkgConfig)
pkg_check_modules (PC_usb QUIET usb)
find_path (usb_INCLUDE_DIR
NAMES libusb.h
PATHS ${PC_usb_INCLUDE_DIRS}
PATH_SUFFIXES libusb-1.0
)
find_library (usb_LIBRARY
NAMES libusb-1.0
PATHS $PC_usb_LIBRARY_DIRS}
)
set (usb_VERSION ${PC_usb_VERSION})
include (FindPackageHandleStandardArgs)
find_package_handle_standard_args (usb
FOUND_VAR usb_FOUND
REQUIRED_VARS
usb_LIBRARY
usb_INCLUDE_DIR
VERSION_VAR usb_VERSION
)
if (usb_FOUND)
set (usb_LIBRARIES ${usb_LIBRARY})
set (usb_INCLUDE_DIRS ${usb_INCLUDE_DIR})
set (usb_DEFINITIONS ${PC_usb_CFLAGS_OTHER})
endif ()
if (usb_FOUND AND NOT TARGET usb::usb)
add_library (usb::usb UNKNOWN IMPORTED)
set_target_properties (usb::usb PROPERTIES
IMPORTED_LOCATION "${usb_LIBRARY}"
INTERFACE_COMPILE_OPTIONS "${PC_usb_CFLAGS_OTHER}"
INTERFACE_INCLUDE_DIRECTORIES "${usb_INCLUDE_DIR}"
)
endif ()
mark_as_advanced (
usb_INCLUDE_DIR
usb_LIBRARY
)

View File

@ -886,19 +886,6 @@ if (WIN32)
find_package (Qt5AxContainer REQUIRED)
endif (WIN32)
#
# sub-directories
#
if (EXISTS ${CMAKE_SOURCE_DIR}/samples AND IS_DIRECTORY ${CMAKE_SOURCE_DIR}/samples)
add_subdirectory (samples)
endif ()
if (WSJT_GENERATE_DOCS)
add_subdirectory (doc)
endif (WSJT_GENERATE_DOCS)
if (EXISTS ${CMAKE_SOURCE_DIR}/tests AND IS_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
add_subdirectory (tests)
endif ()
#
# Library building setup
#
@ -962,7 +949,7 @@ if (Fortran_COMPILER_NAME MATCHES "gfortran.*")
endif (CMAKE_OSX_SYSROOT)
set (CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} -fbounds-check -funroll-all-loops -fno-f2c ${General_FFLAGS}")
set (CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} -fbounds-check -fno-f2c ${General_FFLAGS}")
set (CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} -fbounds-check -fno-f2c -ffpe-trap=denormal,invalid,zero,overflow ${General_FFLAGS}")
elseif (Fortran_COMPILER_NAME MATCHES "ifort.*")
# ifort (untested)
set (CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} -f77rtl ${General_FFLAGS}")
@ -1064,6 +1051,19 @@ elseif (CMAKE_HOST_WIN32)
add_definitions (-DWIN32)
endif ()
#
# sub-directories
#
if (EXISTS ${CMAKE_SOURCE_DIR}/samples AND IS_DIRECTORY ${CMAKE_SOURCE_DIR}/samples)
add_subdirectory (samples)
endif ()
if (WSJT_GENERATE_DOCS)
add_subdirectory (doc)
endif (WSJT_GENERATE_DOCS)
if (EXISTS ${CMAKE_SOURCE_DIR}/tests AND IS_DIRECTORY ${CMAKE_SOURCE_DIR}/tests)
add_subdirectory (tests)
endif ()
# build a library of package functionality (without and optionally with OpenMP support)
add_library (wsjt_cxx STATIC ${wsjt_CSRCS} ${wsjt_CXXSRCS})
target_link_libraries (wsjt_cxx ${LIBM_LIBRARIES} Boost::log_setup ${LIBM_LIBRARIES})
@ -1380,6 +1380,9 @@ else (${OPENMP_FOUND} OR APPLE)
target_link_libraries (jt9 wsjt_fort wsjt_cxx fort_qt)
endif (${OPENMP_FOUND} OR APPLE)
# build map65
add_subdirectory (map65)
# build the main application
generate_version_info (wsjtx_VERSION_RESOURCES
NAME wsjtx

View File

@ -19,6 +19,7 @@ Here is an overview list, details are filled out below:
* Hamlib rig control library
* Pkg Config Lite
* Boost C++ libraries
* portaudio library (used by map65)
Qt Framework
------------
@ -80,7 +81,7 @@ installed and updated you will need to install some packages, these
are needed to provide the necessary *nix tools and utilities to build
Hamlib from sources.
pacman -S autoconf automake libtool make
pacman -S autoconf automake libtool make tar
Hamlib
------
@ -169,3 +170,52 @@ from https://sourceforge.net/projects/pkgconfiglite/files/0.28-1/ and
unzip it into a convenient location, as with other ancillary tools and
libraries I put these under C:\Tools\.
portaudio
---------
This library is only available as sources so must be built. It uses
autotools and building using MinGW tools from an Msys shell is
recommended. Ensure your Msys shell environment (PATH) is correctly
set up for the MinGW tool chain you wish to build with, i.e. the MinGW
tools bundled with the Qt installation for 32-, or 64-bit as required.
Download the latest stable version sources tarball from
http://files.portaudio.com/download.html , at the time of writing that
was the pa_stable_v190700_20210406.tgz file. Unzip and unpack the
tarball in a suitable location like ~/src :
cd ~/src
tar xf ~/Downloads/pa_stable_v190700_20210406.tgz
out-of-source-tree builds are recommended, create a build directory in
a suitable location like ~/build and change working directory to it:
mkdir -p ~/build/portaudio/mingw64
cd !$
Configure and build and install the library in a suitable place (I use
~/local as a root directory for installed packages.
~/src/portaudio/configure --prefix=$(HOME)/local/portaudio/mingw64 --with-winapi=wmme,directx,wdmks CFLAGS=-DNDEBUG
make && make install
Repeat for the 32-bit architecture if required, using a suitable Msys
environment for the required tool chain, different build directory,
and install location.
Update your CMake tool chain files to include the install directory,
or directories, above. I have something like this in the 64-bit tool
chain files:
# ...
set (PORTAUDIODIR C:/Users/bill/local/portaudio/mingw64)
# ...
set (CMAKE_PREFIX_PATH ... ${PORTAUDIODIR} ...)
#...
and similarly with the 32-bit tool chain file specifying the mingw32
portaudio installation root directory.
Note that on Windows portaudio will only build static libraries using
the standard configuration, this is fine and therefore there is no
need to add any new run-time paths to your execution environment.

View File

@ -34,12 +34,8 @@ void *INIT_RS(unsigned int symsize,unsigned int gfpoly,unsigned fcr,unsigned pri
struct rs *rs;
int i, j, sr,root,iprim;
<<<<<<< HEAD:lib/init_rs.c
/* Check parameter ranges */
if(symsize < 0 || symsize > (int)(8*sizeof(DTYPE)))
=======
if(symsize > 8*sizeof(DTYPE))
>>>>>>> 280c8344cd80339491e9bad1dcc4ac9a1e5f684e:map65/libm65/init_rs.c
return NULL; /* Need version with ints rather than chars */
if(fcr >= (1<<symsize))

View File

@ -1,27 +1,8 @@
cmake_minimum_required (VERSION 2.8.9)
find_package (portaudio REQUIRED)
project (map65 C CXX Fortran)
find_package (usb REQUIRED)
set (MAP65_VERSION_MAJOR 1)
set (MAP65_VERSION_MINOR 3)
if (POLICY CMP0020)
cmake_policy (SET CMP0020 NEW) # link to Qt winmain on Windows
endif (POLICY CMP0020)
# make sure that the default is a RELEASE
if (NOT CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE RELEASE CACHE STRING
"Choose the type of build, options are: None Debug Release."
FORCE)
endif (NOT CMAKE_BUILD_TYPE)
# C++ setup
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
set (CXXSRCS
set (map65_CXXSRCS
about.cpp
astro.cpp
bandmap.cpp
@ -43,17 +24,15 @@ set (CXXSRCS
)
if (WIN32)
set (CXXSRCS ${CXXSRCS} killbyname.cpp)
set (map65_CXXSRCS ${map65_CXXSRCS} killbyname.cpp)
endif (WIN32)
set (CSRCS
set (map65_CSRCS
paInputDevice.c
pa_get_device_info.c
)
set_property (SOURCE ${CXXSRCS} ${CSRCS} APPEND PROPERTY COMPILE_FLAGS "-include map65_config.h")
set (UISRCS
set (map65_UISRCS
about.ui
astro.ui
bandmap.ui
@ -64,102 +43,18 @@ set (UISRCS
widegraph.ui
)
# sort out pre-requisites
# libfftw3 setup
find_path (fftw3f_INCLUDES fftw3.f)
find_library (fftw3f_LIBRARIES NAMES fftw3f fftw3f-3)
include_directories (${fftw3f_INCLUDES})
if (WIN32)
find_library (usb_RUNTIME NAMES usb0 PATH_SUFFIXES bin)
set (CMAKE_INSTALL_PREFIX C:/MAP65)
endif (WIN32)
# Qt5 setup
# Widgets finds its own dependencies.
find_package (Qt5Widgets REQUIRED)
find_package (Qt5Multimedia REQUIRED)
# Tell CMake to run moc when necessary
set (CMAKE_AUTOMOC ON)
# don't use Qt "keywords" signal, slot, emit in generated files to
# avoid compatability issue with other libraries
#ADD_DEFINITIONS (-DQT_NO_KEYWORDS)
# As moc files are generated in the binary dir, tell CMake to always
# look for includes there:
set (CMAKE_INCLUDE_CURRENT_DIR ON)
# project definitions
add_definitions (-DQT5)
if (CMAKE_HOST_UNIX)
add_definitions (-DUNIX)
elseif (CMAKE_HOST_WIN32)
add_definitions (-DWIN32)
endif ()
#set_property (DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_RELEASE QT_NO_DEBUG_OUTPUT QT_NO_WARNING_OUTPUT)
set_property (DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_RELEASE QT_NO_WARNING_OUTPUT)
# build the subdirectories
add_subdirectory (libm65)
# UI generation
qt5_wrap_ui (GENUISRCS ${UISRCS})
add_executable (map65 ${CXXSRCS} ${CSRCS} ${GENUISRCS} map65.rc)
target_link_libraries (map65 m65impl ${fftw3f_LIBRARIES} ${CMAKE_CURRENT_SOURCE_DIR}/palir-02.dll ${CMAKE_CURRENT_SOURCE_DIR}/libusb0.dll ${CMAKE_CURRENT_SOURCE_DIR}/libwsock32.a)
if (WIN32)
target_link_libraries (map65)
# set_target_properties (map65 PROPERTIES LINK_FLAGS_RELEASE "${LINKER_FLAGS_RELEASE} ")
set_target_properties (map65 PROPERTIES LINK_FLAGS_RELEASE "${LINKER_FLAGS_RELEASE} -mwindows")
endif (WIN32)
qt5_use_modules (map65 Widgets Multimedia OpenGL)
qt5_wrap_ui (map65_GENUISRCS ${map65_UISRCS})
add_executable (map65 ${map65_CXXSRCS} ${map65_CSRCS} ${map65_GENUISRCS} map65.rc)
target_include_directories (map65 PRIVATE ${PORTAUDIO_INCLUDE_DIRS})
target_link_libraries (map65 m65impl ${FFTW3_LIBRARIES} Qt5::Widgets Qt5::Network ${PORTAUDIO_STATIC_LDFLAGS} usb::usb)
install (
TARGETS map65
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
)
# install (DIRECTORY Palettes DESTINATION bin PATTERN *.pal)
# install (DIRECTORY samples DESTINATION bin/save)
install (FILES
# CALL3.TXT
# prefixes.txt
DESTINATION bin
)
if (WIN32)
install (
FILES ${fftw3f_LIBRARIES} ${usb_RUNTIME}
DESTINATION bin COMPONENT Runtime
)
endif (WIN32)
# a custom target that is always built
ADD_CUSTOM_TARGET (revisiontag ALL)
# creates svnversion.h using cmake script
ADD_CUSTOM_COMMAND (TARGET revisiontag COMMAND ${CMAKE_COMMAND}
-DSOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}
-P ${CMAKE_CURRENT_SOURCE_DIR}/getsvn.cmake)
# explicitly say that the executable depends on custom target
add_dependencies(map65 revisiontag)
# versioning
configure_file (
"${PROJECT_SOURCE_DIR}/map65_config.h.in"
"${PROJECT_BINARY_DIR}/map65_config.h"
)
include_directories ("${PROJECT_BINARY_DIR}")

View File

@ -38,7 +38,7 @@ void BandMap::setText(QString t)
s3="<span style=color:"+m_color3+";>";
ui->bmTextBrowser->clear();
QStringList lines = t.split( "\n", QString::SkipEmptyParts );
QStringList lines = t.split( "\n", Qt::SkipEmptyParts );
int nrows=(lines.length()+ncols-1)/ncols;
for(int i=0; i<nrows; i++) {

View File

@ -1,5 +1,6 @@
#include "devsetup.h"
#include "mainwindow.h"
#include <QTextStream>
#include <QDebug>
#include <portaudio.h>
@ -26,7 +27,7 @@ void DevSetup::initDlg()
int minSpeed[MAXDEVICES];
int maxSpeed[MAXDEVICES];
char hostAPI_DeviceName[MAXDEVICES][50];
char s[60];
char s[256];
int numDevices=Pa_GetDeviceCount();
getDev(&numDevices,hostAPI_DeviceName,minChan,maxChan,minSpeed,maxSpeed);
k=0;
@ -44,7 +45,7 @@ void DevSetup::initDlg()
const PaDeviceInfo *pdi;
int nchout;
char *p,*p1;
char p2[50];
char p2[256];
char pa_device_name[128];
char pa_device_hostapi[128];
@ -110,8 +111,10 @@ void DevSetup::initDlg()
ui.mult570TxSpinBox->setValue(m_mult570Tx);
ui.cal570SpinBox->setValue(m_cal570);
ui.sbTxOffset->setValue(m_TxOffset);
sscanf(m_colors.toLatin1(),"%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x",
&r,&g,&b,&r0,&g0,&b0,&r1,&g1,&b1,&r2,&g2,&b2,&r3,&g3,&b3);
QTextStream its {&m_colors, QIODevice::ReadOnly};
its.setIntegerBase (16);
its.setFieldWidth (2);
its >> r >> g >> b >> r0 >> g0 >> b0 >> r1 >> g1 >> b1 >> r2 >> g2 >> b2 >> r3 >> g3 >> b3;
updateColorLabels();
ui.sbBackgroundRed->setValue(r);
ui.sbBackgroundGreen->setValue(g);
@ -234,95 +237,122 @@ void DevSetup::updateColorLabels()
int b2=ui.sbBlue2->value();
int b3=ui.sbBlue3->value();
t.sprintf("QLabel{background-color: #%2.2x%2.2x%2.2x;"
"color: #%2.2x%2.2x%2.2x}",r,g,b,r0,g0,b0);
ui.lab0->setStyleSheet(t);
t.sprintf("QLabel{background-color: #%2.2x%2.2x%2.2x;"
"color: #%2.2x%2.2x%2.2x}",r,g,b,r1,g1,b1);
ui.lab1->setStyleSheet(t);
t.sprintf("QLabel{background-color: #%2.2x%2.2x%2.2x;"
"color: #%2.2x%2.2x%2.2x}",r,g,b,r2,g2,b2);
ui.lab2->setStyleSheet(t);
t.sprintf("QLabel{background-color: #%2.2x%2.2x%2.2x;"
"color: #%2.2x%2.2x%2.2x}",r,g,b,r3,g3,b3);
ui.lab3->setStyleSheet(t);
ui.lab0->setStyleSheet (
QString {"QLabel{background-color: #%1%2%3; color: #%4%5%6}"}
.arg (r, 2, 16, QLatin1Char {'0'})
.arg (g, 2, 16, QLatin1Char {'0'})
.arg (b, 2, 16, QLatin1Char {'0'})
.arg (r0, 2, 16, QLatin1Char {'0'})
.arg (g0, 2, 16, QLatin1Char {'0'})
.arg (b0, 2, 16, QLatin1Char {'0'})
);
ui.lab1->setStyleSheet(
QString {"QLabel{background-color: #%1%2%3; color: #%4%5%6}"}
.arg (r, 2, 16, QLatin1Char {'0'})
.arg (g, 2, 16, QLatin1Char {'0'})
.arg (b, 2, 16, QLatin1Char {'0'})
.arg (r1, 2, 16, QLatin1Char {'0'})
.arg (g1, 2, 16, QLatin1Char {'0'})
.arg (b1, 2, 16, QLatin1Char {'0'})
);
ui.lab2->setStyleSheet(
QString {"QLabel{background-color: #%1%2%3; color: #%4%5%6}"}
.arg (r, 2, 16, QLatin1Char {'0'})
.arg (g, 2, 16, QLatin1Char {'0'})
.arg (b, 2, 16, QLatin1Char {'0'})
.arg (r2, 2, 16, QLatin1Char {'0'})
.arg (g2, 2, 16, QLatin1Char {'0'})
.arg (b2, 2, 16, QLatin1Char {'0'})
);
ui.lab3->setStyleSheet(
QString {"QLabel{background-color: #%1%2%3; color: #%4%5%6}"}
.arg (r, 2, 16, QLatin1Char {'0'})
.arg (g, 2, 16, QLatin1Char {'0'})
.arg (b, 2, 16, QLatin1Char {'0'})
.arg (r3, 2, 16, QLatin1Char {'0'})
.arg (g3, 2, 16, QLatin1Char {'0'})
.arg (b3, 2, 16, QLatin1Char {'0'})
);
m_colors.sprintf("%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x"
"%2.2x%2.2x%2.2x",r,g,b,r0,g0,b0,r1,g1,b1,r2,g2,b2,r3,g3,b3);
QTextStream ots {&m_colors, QIODevice::WriteOnly};
ots.setIntegerBase (16);
ots.setFieldWidth (2);
ots.setPadChar ('0');
ots << r << g << b << r0 << g0 << b0 << r1 << g1 << b1 << r2 << g2 << b2 << r3 << g3 << b3;
}
void DevSetup::on_sbBackgroundRed_valueChanged(int r)
void DevSetup::on_sbBackgroundRed_valueChanged(int /*r*/)
{
updateColorLabels();
}
void DevSetup::on_sbBackgroundGreen_valueChanged(int g)
void DevSetup::on_sbBackgroundGreen_valueChanged(int /*g*/)
{
updateColorLabels();
}
void DevSetup::on_sbBackgroundBlue_valueChanged(int b)
void DevSetup::on_sbBackgroundBlue_valueChanged(int /*b*/)
{
updateColorLabels();
}
void DevSetup::on_sbRed0_valueChanged(int arg1)
void DevSetup::on_sbRed0_valueChanged(int /*arg1*/)
{
updateColorLabels();
}
void DevSetup::on_sbGreen0_valueChanged(int arg1)
void DevSetup::on_sbGreen0_valueChanged(int /*arg1*/)
{
updateColorLabels();
}
void DevSetup::on_sbBlue0_valueChanged(int arg1)
void DevSetup::on_sbBlue0_valueChanged(int /*arg1*/)
{
updateColorLabels();
}
void DevSetup::on_sbRed1_valueChanged(int arg1)
void DevSetup::on_sbRed1_valueChanged(int /*arg1*/)
{
updateColorLabels();
}
void DevSetup::on_sbGreen1_valueChanged(int arg1)
void DevSetup::on_sbGreen1_valueChanged(int /*arg1*/)
{
updateColorLabels();
}
void DevSetup::on_sbBlue1_valueChanged(int arg1)
void DevSetup::on_sbBlue1_valueChanged(int /*arg1*/)
{
updateColorLabels();
}
void DevSetup::on_sbRed2_valueChanged(int arg1)
void DevSetup::on_sbRed2_valueChanged(int /*arg1*/)
{
updateColorLabels();
}
void DevSetup::on_sbGreen2_valueChanged(int arg1)
void DevSetup::on_sbGreen2_valueChanged(int /*arg1*/)
{
updateColorLabels();
}
void DevSetup::on_sbBlue2_valueChanged(int arg1)
void DevSetup::on_sbBlue2_valueChanged(int /*arg1*/)
{
updateColorLabels();
}
void DevSetup::on_sbRed3_valueChanged(int arg1)
void DevSetup::on_sbRed3_valueChanged(int /*arg1*/)
{
updateColorLabels();
}
void DevSetup::on_sbGreen3_valueChanged(int arg1)
void DevSetup::on_sbGreen3_valueChanged(int /*arg1*/)
{
updateColorLabels();
}
void DevSetup::on_sbBlue3_valueChanged(int arg1)
void DevSetup::on_sbBlue3_valueChanged(int /*arg1*/)
{
updateColorLabels();
}

View File

@ -1,64 +0,0 @@
INTEGER FFTW_R2HC
PARAMETER (FFTW_R2HC=0)
INTEGER FFTW_HC2R
PARAMETER (FFTW_HC2R=1)
INTEGER FFTW_DHT
PARAMETER (FFTW_DHT=2)
INTEGER FFTW_REDFT00
PARAMETER (FFTW_REDFT00=3)
INTEGER FFTW_REDFT01
PARAMETER (FFTW_REDFT01=4)
INTEGER FFTW_REDFT10
PARAMETER (FFTW_REDFT10=5)
INTEGER FFTW_REDFT11
PARAMETER (FFTW_REDFT11=6)
INTEGER FFTW_RODFT00
PARAMETER (FFTW_RODFT00=7)
INTEGER FFTW_RODFT01
PARAMETER (FFTW_RODFT01=8)
INTEGER FFTW_RODFT10
PARAMETER (FFTW_RODFT10=9)
INTEGER FFTW_RODFT11
PARAMETER (FFTW_RODFT11=10)
INTEGER FFTW_FORWARD
PARAMETER (FFTW_FORWARD=-1)
INTEGER FFTW_BACKWARD
PARAMETER (FFTW_BACKWARD=+1)
INTEGER FFTW_MEASURE
PARAMETER (FFTW_MEASURE=0)
INTEGER FFTW_DESTROY_INPUT
PARAMETER (FFTW_DESTROY_INPUT=1)
INTEGER FFTW_UNALIGNED
PARAMETER (FFTW_UNALIGNED=2)
INTEGER FFTW_CONSERVE_MEMORY
PARAMETER (FFTW_CONSERVE_MEMORY=4)
INTEGER FFTW_EXHAUSTIVE
PARAMETER (FFTW_EXHAUSTIVE=8)
INTEGER FFTW_PRESERVE_INPUT
PARAMETER (FFTW_PRESERVE_INPUT=16)
INTEGER FFTW_PATIENT
PARAMETER (FFTW_PATIENT=32)
INTEGER FFTW_ESTIMATE
PARAMETER (FFTW_ESTIMATE=64)
INTEGER FFTW_ESTIMATE_PATIENT
PARAMETER (FFTW_ESTIMATE_PATIENT=128)
INTEGER FFTW_BELIEVE_PCOST
PARAMETER (FFTW_BELIEVE_PCOST=256)
INTEGER FFTW_DFT_R2HC_ICKY
PARAMETER (FFTW_DFT_R2HC_ICKY=512)
INTEGER FFTW_NONTHREADED_ICKY
PARAMETER (FFTW_NONTHREADED_ICKY=1024)
INTEGER FFTW_NO_BUFFERING
PARAMETER (FFTW_NO_BUFFERING=2048)
INTEGER FFTW_NO_INDIRECT_OP
PARAMETER (FFTW_NO_INDIRECT_OP=4096)
INTEGER FFTW_ALLOW_LARGE_GENERIC
PARAMETER (FFTW_ALLOW_LARGE_GENERIC=8192)
INTEGER FFTW_NO_RANK_SPLITS
PARAMETER (FFTW_NO_RANK_SPLITS=16384)
INTEGER FFTW_NO_VRANK_SPLITS
PARAMETER (FFTW_NO_VRANK_SPLITS=32768)
INTEGER FFTW_NO_VRECURSE
PARAMETER (FFTW_NO_VRECURSE=65536)
INTEGER FFTW_NO_SIMD
PARAMETER (FFTW_NO_SIMD=131072)

View File

@ -185,7 +185,7 @@ void paInputDevice(int id, char* hostAPI_DeviceName, int* minChan,
int pa_device_min_bytes;
int pa_device_max_channels;
int pa_device_min_channels;
char p2[50];
char p2[256];
char *p,*p1;
static int iret, valid_dev_cnt;

View File

@ -35,7 +35,7 @@ int killbyname(const char *szToTerminate)
HANDLE hProc,hSnapShot,hSnapShotm;
OSVERSIONINFO osvi;
HINSTANCE hInstLib;
int iLen,iLenP,indx;
int iLenP,indx;
HMODULE hMod;
PROCESSENTRY32 procentry;
MODULEENTRY32 modentry;
@ -83,12 +83,12 @@ int killbyname(const char *szToTerminate)
if(hInstLib == NULL) return 605;
// Get procedure addresses.
lpfEnumProcesses = (BOOL(WINAPI *)(DWORD *,DWORD,DWORD*))
lpfEnumProcesses = (BOOL(WINAPI *)(DWORD *,DWORD,DWORD*))(void (*)())
GetProcAddress( hInstLib, "EnumProcesses" ) ;
lpfEnumProcessModules = (BOOL(WINAPI *)(HANDLE, HMODULE *,
DWORD, LPDWORD)) GetProcAddress( hInstLib, "EnumProcessModules" ) ;
DWORD, LPDWORD))(void (*)()) GetProcAddress( hInstLib, "EnumProcessModules" ) ;
lpfGetModuleBaseName =(DWORD (WINAPI *)(HANDLE, HMODULE, LPTSTR,
DWORD )) GetProcAddress( hInstLib, "GetModuleBaseNameA" ) ;
DWORD )) (void (*)())GetProcAddress( hInstLib, "GetModuleBaseNameA" ) ;
if(lpfEnumProcesses == NULL || lpfEnumProcessModules == NULL ||
lpfGetModuleBaseName == NULL) {
@ -116,7 +116,7 @@ int killbyname(const char *szToTerminate)
// Now, get the process name
if(hProc) {
if(lpfEnumProcessModules(hProc,&hMod,sizeof(hMod),&iCbneeded) ) {
iLen=lpfGetModuleBaseName(hProc,hMod,szName,MAX_PATH);
lpfGetModuleBaseName(hProc,hMod,szName,MAX_PATH);
}
}
CloseHandle(hProc);
@ -162,20 +162,20 @@ int killbyname(const char *szToTerminate)
// which does not have the Toolhelp32
// functions in the Kernel 32.
lpfCreateToolhelp32Snapshot=
(HANDLE(WINAPI *)(DWORD,DWORD))
(HANDLE(WINAPI *)(DWORD,DWORD))(void (*)())
GetProcAddress( hInstLib,
"CreateToolhelp32Snapshot" ) ;
lpfProcess32First=
(BOOL(WINAPI *)(HANDLE,LPPROCESSENTRY32))
(BOOL(WINAPI *)(HANDLE,LPPROCESSENTRY32))(void (*)())
GetProcAddress( hInstLib, "Process32First" ) ;
lpfProcess32Next=
(BOOL(WINAPI *)(HANDLE,LPPROCESSENTRY32))
(BOOL(WINAPI *)(HANDLE,LPPROCESSENTRY32))(void (*)())
GetProcAddress( hInstLib, "Process32Next" ) ;
lpfModule32First=
(BOOL(WINAPI *)(HANDLE,LPMODULEENTRY32))
(BOOL(WINAPI *)(HANDLE,LPMODULEENTRY32))(void (*)())
GetProcAddress( hInstLib, "Module32First" ) ;
lpfModule32Next=
(BOOL(WINAPI *)(HANDLE,LPMODULEENTRY32))
(BOOL(WINAPI *)(HANDLE,LPMODULEENTRY32))(void (*)())
GetProcAddress( hInstLib, "Module32Next" ) ;
if( lpfProcess32Next == NULL ||
lpfProcess32First == NULL ||

Binary file not shown.

View File

@ -1,61 +1,4 @@
cmake_minimum_required (VERSION 2.8.8)
project (libm65 C CXX Fortran)
if (POLICY CMP0020)
cmake_policy (SET CMP0020 NEW) # link to Qt winmain on Windows
endif (POLICY CMP0020)
# make sure that the default is a RELEASE
if (NOT CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE RELEASE CACHE STRING
"Choose the type of build, options are: None Debug Release."
FORCE)
endif (NOT CMAKE_BUILD_TYPE)
set (CMAKE_POSITION_INDEPENDENT_CODE ON)
# Fortran setup
# FFLAGS depend on the compiler
get_filename_component (Fortran_COMPILER_NAME ${CMAKE_Fortran_COMPILER} NAME)
if (Fortran_COMPILER_NAME MATCHES "gfortran.*")
# gfortran
# set (CMAKE_Fortran_FLAGS_RELEASE "-funroll-all-loops -fno-f2c -O3")
set (CMAKE_Fortran_FLAGS_RELEASE "-O2 -fbounds-check")
set (CMAKE_Fortran_FLAGS_DEBUG "-fno-f2c -O0 -g")
elseif (Fortran_COMPILER_NAME MATCHES "ifort.*")
# ifort (untested)
set (CMAKE_Fortran_FLAGS_RELEASE "-f77rtl -O3")
set (CMAKE_Fortran_FLAGS_DEBUG "-f77rtl -O0 -g")
elseif (Fortran_COMPILER_NAME MATCHES "g77")
# g77
set (CMAKE_Fortran_FLAGS_RELEASE "-funroll-all-loops -fno-f2c -O3 -m32")
set (CMAKE_Fortran_FLAGS_DEBUG "-fno-f2c -O0 -g -m32")
else (Fortran_COMPILER_NAME MATCHES "gfortran.*")
message ("CMAKE_Fortran_COMPILER full path: " ${CMAKE_Fortran_COMPILER})
message ("Fortran compiler: " ${Fortran_COMPILER_NAME})
message ("No optimized Fortran compiler flags are known, we just try -O2...")
set (CMAKE_Fortran_FLAGS_RELEASE "-O2")
set (CMAKE_Fortran_FLAGS_DEBUG "-O0 -g")
endif (Fortran_COMPILER_NAME MATCHES "gfortran.*")
# C++ setup
if (UNIX)
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
endif (UNIX)
# setup and test Fortran C/C++ interaction
include (FortranCInterface)
FortranCInterface_VERIFY (CXX QUIET)
FortranCInterface_HEADER (FC.h MACRO_NAMESPACE "FC_" SYMBOL_NAMESPACE "FC_"
SYMBOLS )
set (FSRCS
set (libm65_FSRCS
afc65b.f90
astro.f90
astro0.f90
@ -88,7 +31,9 @@ set (FSRCS
four2a.f90
ftninit.f90
ftnquit.f90
q65b.f90
gen65.f90
gen_q65_wave.f90
genqra64a.f90
geocentric.f90
getdphi.f90
@ -136,17 +81,23 @@ set (FSRCS
trimlist.f90
twkfreq.f90
twkfreq_xy.f90
wavhdr.f90
f77_wisdom.f
)
set (CSRCS
set (libm65_ka9q_CSRCS
decode_rs.c
encode_rs.c
init_rs.c
)
set_source_files_properties (${libm65_ka9q_CSRCS} PROPERTIES COMPILE_FLAGS -Wno-sign-compare)
set (libm65_CSRCS
${libm65_ka9q_CSRCS}
ftrsd2.c
gran.c
igray.c
init_rs.c
tmoonsub.c
usleep.c
wrapkarn.c
@ -161,11 +112,12 @@ set (CSRCS
)
if (WIN32)
set (CSRCS ${CSRCS} ptt.c)
else (set (CSRCS ${CSRCS} ptt_unix.c))
endif (WIN32)
set (libm65_CSRCS ${libm65_CSRCS} ptt.c)
else ()
set (libm65_CSRCS ${libm65_CSRCS} ptt_unix.c)
endif ()
set (CXXSRCS
set (libm65_CXXSRCS
ipcomm.cpp
)
@ -175,13 +127,11 @@ set_source_files_properties (sec_midn.f90 PROPERTIES COMPILE_FLAGS -fno-second-u
#
# build our targets
#
add_library (m65impl STATIC ${FSRCS} ${CSRCS} ${CXXSRCS})
qt5_use_modules (m65impl Core)
add_library (m65impl STATIC ${libm65_FSRCS} ${libm65_CSRCS} ${libm65_CXXSRCS})
target_link_libraries (m65impl Qt5::Core)
add_executable (m65 m65.f90 m65a.f90)
target_link_libraries (m65 m65impl ${fftw3f_LIBRARIES})
add_dependencies (m65 fftw3f)
qt5_use_modules (m65 Core)
target_link_libraries (m65 m65impl ${FFTW3_LIBRARIES})
install (
TARGETS m65

Binary file not shown.

Binary file not shown.

View File

@ -7,10 +7,22 @@
#include "mainwindow.h"
static QtMessageHandler default_message_handler;
void my_message_handler (QtMsgType type, QMessageLogContext const& context, QString const& msg)
{
// Handle the messages!
// Call the default handler.
(*default_message_handler) (type, context, msg);
}
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
default_message_handler = qInstallMessageHandler (my_message_handler);
QApplication a {argc, argv};
MainWindow w;
w.show ();
return a.exec ();
}

View File

@ -10,7 +10,7 @@
#include "bandmap.h"
#include "txtune.h"
#include "sleep.h"
#include "portaudio.h"
#include <portaudio.h>
#define NFFT 32768
@ -202,7 +202,7 @@ MainWindow::MainWindow(QWidget *parent) :
lockFile.open(QIODevice::ReadWrite);
QFile quitFile(m_appDir + "/.lock");
quitFile.remove();
proc_m65.start(QDir::toNativeSeparators(m_appDir + "/m65 -s"));
proc_m65.start(QDir::toNativeSeparators(m_appDir + "/m65"), {"-s", });
m_pbdecoding_style1="QPushButton{background-color: cyan; \
border-style: outset; border-width: 1px; border-radius: 5px; \
@ -564,9 +564,20 @@ void MainWindow::dataSink(int k)
&px, &py, s, &nkhz, &ihsym, &nzap, &slimit, lstrong);
QString t;
m_pctZap=nzap/178.3;
if(m_xpol) t.sprintf(" Rx noise: %5.1f %5.1f %5.1f %% ",px,py,m_pctZap);
if(!m_xpol) t.sprintf(" Rx noise: %5.1f %5.1f %% ",px,m_pctZap);
lab4->setText(t);
if(m_xpol) {
lab4->setText (
QString {" Rx noise: %1 %2 %3 %% "}
.arg (px, 5, 'f', 1)
.arg (py, 5, 'f', 1)
.arg (m_pctZap, 5, 'f', 1)
);
} else {
lab4->setText (
QString {" Rx noise: %1 %2 %% "}
.arg (px, 5, 'f', 1)
.arg (m_pctZap, 5, 'f', 1)
);
}
xSignalMeter->setValue(px); // Update the signal meters
ySignalMeter->setValue(py);
if(m_monitoring || m_diskData) {
@ -575,10 +586,18 @@ void MainWindow::dataSink(int k)
if(nadj == 10) {
if(m_xpol) {
t.sprintf("Amp: %6.4f %6.4f Phase: %6.4f %6.4f",
m_gainx,m_gainy,m_phasex,m_phasey);
ui->decodedTextBrowser->append (
QString {"Amp: %1 %2 Phase: %3 %4"}
.arg (m_gainx, 6, 'f', 4).arg (m_gainy, 6, 'f', 4)
.arg (m_phasex, 6, 'f', 4)
.arg (m_phasey, 6, 'f', 4)
);
} else {
t.sprintf("Amp: %6.4f Phase: %6.4f",m_gainx,m_phasex);
ui->decodedTextBrowser->append(
QString {"Amp: %1 Phase: %1"}
.arg (m_gainx, 6, 'f', 4)
.arg (m_phasex, 6, 'f', 4)
);
}
ui->decodedTextBrowser->append(t);
m_adjustIQ=0;
@ -798,6 +817,7 @@ void MainWindow::keyPressEvent( QKeyEvent *e ) //keyPressEvent
m_ntx=6;
ui->txrb6->setChecked(true);
}
break;
case Qt::Key_F6:
if(e->modifiers() & Qt::ShiftModifier) {
on_actionDecode_remaining_files_in_directory_triggered();
@ -824,8 +844,8 @@ void MainWindow::keyPressEvent( QKeyEvent *e ) //keyPressEvent
case Qt::Key_G:
if(e->modifiers() & Qt::AltModifier) {
genStdMsgs("");
break;
}
break;
case Qt::Key_L:
if(e->modifiers() & Qt::ControlModifier) {
lookup();
@ -1288,11 +1308,11 @@ void MainWindow::decode() //decode()
QString hcall=(ui->dxCallEntry->text()+" ").mid(0,12);
QString hgrid=(ui->dxGridEntry->text()+" ").mid(0,6);
strncpy(datcom_.mycall, mcall.toLatin1(), 12);
strncpy(datcom_.mygrid, mgrid.toLatin1(), 6);
strncpy(datcom_.hiscall, hcall.toLatin1(), 12);
strncpy(datcom_.hisgrid, hgrid.toLatin1(), 6);
strncpy(datcom_.datetime, m_dateTime.toLatin1(), 20);
memcpy(datcom_.mycall, mcall.toLatin1(), 12);
memcpy(datcom_.mygrid, mgrid.toLatin1(), 6);
memcpy(datcom_.hiscall, hcall.toLatin1(), 12);
memcpy(datcom_.hisgrid, hgrid.toLatin1(), 6);
memcpy(datcom_.datetime, m_dateTime.toLatin1(), 20);
//newdat=1 ==> this is new data, must do the big FFT
//nagain=1 ==> decode only at fQSO +/- Tol
@ -1345,9 +1365,7 @@ void MainWindow::readFromStdout() //readFromStdout
if(t.indexOf("<QuickDecodeDone>") >= 0) {
m_nsum=t.mid(17,4).toInt();
m_nsave=t.mid(21,4).toInt();
QString t2;
t2.sprintf("Avg: %d",m_nsum);
lab7->setText(t2);
lab7->setText (QString {"Avg: %1"}.arg (m_nsum));
if(m_modeQ65>0) g_pWideGraph->setDecodeFinished();
}
if(t.indexOf("<DecodeFinished>") >= 0) {
@ -1502,7 +1520,7 @@ void MainWindow::guiUpdate()
f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append);
QTextStream out(&f);
out << QDateTime::currentDateTimeUtc().toString("yyyy-MMM-dd hh:mm")
<< " Tx message: " << QString::fromLatin1(msgsent) << endl;
<< " Tx message: " << QString::fromLatin1(msgsent) << Qt::endl;
f.close();
}
@ -1525,7 +1543,7 @@ void MainWindow::guiUpdate()
f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append);
QTextStream out(&f);
out << QDateTime::currentDateTimeUtc().toString("yyyy-MMM-dd hh:mm")
<< " Tx message: " << QString::fromLatin1(msgsent) << endl;
<< " Tx message: " << QString::fromLatin1(msgsent) << Qt::endl;
f.close();
}
@ -1643,14 +1661,14 @@ void MainWindow::ba2msg(QByteArray ba, char message[]) //ba2msg()
bool eom;
eom=false;
for(int i=0;i<22; i++) {
if((int)ba[i] == 0) eom=true;
if (i >= ba.size () || !ba[i]) eom=true;
if(eom) {
message[i]=32;
message[i] = ' ';
} else {
message[i]=ba[i];
}
}
message[22]=0;
message[22] = '\0';
}
void MainWindow::on_txFirstCheckBox_stateChanged(int nstate) //TxFirst
@ -1867,7 +1885,7 @@ void MainWindow::on_addButton_clicked() //Add button
if(f1.size()==0) {
QTextStream out(&f1);
out << "ZZZZZZ" << endl;
out << "ZZZZZZ" << Qt::endl;
f1.close();
f1.open(QIODevice::ReadOnly | QIODevice::Text);
}
@ -2192,13 +2210,12 @@ void MainWindow::on_actionApply_IQ_Calibration_triggered()
void MainWindow::on_actionFUNcube_Dongle_triggered()
{
proc_qthid.start(QDir::toNativeSeparators(m_appDir + "/qthid"));
proc_qthid.start (QDir::toNativeSeparators(m_appDir + "/qthid"), QStringList {});
}
void MainWindow::on_actionEdit_wsjt_log_triggered()
{
QString cmnd=m_editorCommand + " " + m_appDir + "/wsjt.log";
proc_editor.start(QDir::toNativeSeparators(cmnd));
proc_editor.start (QDir::toNativeSeparators (m_editorCommand), {QDir::toNativeSeparators (m_appDir + "/wsjt.log"), });
}
void MainWindow::on_actionTx_Tune_triggered()

View File

@ -31,7 +31,7 @@ void Messages::setText(QString t, QString t2)
ui->messagesTextBrowser->setStyleSheet(s);
ui->messagesTextBrowser->clear();
QStringList lines = t.split( "\n", QString::SkipEmptyParts );
QStringList lines = t.split( "\n", Qt::SkipEmptyParts );
foreach( QString line, lines ) {
QString t1=line.mid(0,50);
int ncq=t1.indexOf(" CQ ");
@ -57,7 +57,7 @@ void Messages::setText(QString t, QString t2)
}
}
void Messages::selectCallsign2(bool ctrl)
void Messages::selectCallsign2(bool /*ctrl*/)
{
QString t = ui->messagesTextBrowser->toPlainText(); //Full contents
int i=ui->messagesTextBrowser->textCursor().position();

View File

@ -32,9 +32,7 @@ void MeterWidget::setValue(int value)
void MeterWidget::paintEvent( QPaintEvent * )
{
int pos;
QPainter p;
p.begin(this);
QPainter p {this};
// Sanitize
m_signal = m_signal < 0 ? 0 : m_signal;

View File

@ -14,7 +14,7 @@ void paInputDevice(int id, char* hostAPI_DeviceName, int* minChan,
int pa_device_min_bytes;
int pa_device_max_channels;
int pa_device_min_channels;
char p2[50];
char p2[256];
char *p,*p1;
static int iret, valid_dev_cnt;

View File

@ -1,5 +1,6 @@
#include <portaudio.h>
#include <stdio.h>
#include <string.h>
#define MAX_LATENCY 20

Binary file not shown.

View File

@ -285,7 +285,6 @@ void CPlotter::DrawOverlay() //DrawOverlay()
QRect rect0;
QPainter painter0(&m_ScalePixmap);
painter0.initFrom(this);
//create Font to use for scales
QFont Font("Arial");
@ -365,7 +364,6 @@ void CPlotter::DrawOverlay() //DrawOverlay()
// Now make the zoomed scale, using m_ZoomScalePixmap and painter3
QRect rect1;
QPainter painter3(&m_ZoomScalePixmap);
painter3.initFrom(this);
painter3.setFont(Font);
painter3.setPen(Qt::black);

File diff suppressed because it is too large Load Diff

View File

@ -22,8 +22,7 @@
#include <windows.h>
#endif
#include <usb.h>
//#include "/users/joe/linrad/3.37/usb.h"
#include <libusb.h>
#include <QDebug>
#define USB_SUCCESS 0
@ -48,21 +47,15 @@ int increment_freq;
int retval = -1;
int display_freq = -1;
int delay;
usb_dev_handle *global_si570usb_handle = NULL;
static libusb_device_handle * global_si570usb_handle;
// ********sleep functions***************
//use this function under LINUX
/*
void si570_sleep(int us)
{
usleep(us);
}
*/
//use this function under WINDOWS
void si570_sleep(int us)
{
Sleep(us/1000);
#if defined (Q_OS_WIN)
::Sleep (us / 1000);
#else
::usleep (us);
#endif
}
double round(double x)
@ -78,11 +71,9 @@ double current_time(void) //for delay measurements
return 0.000001*t.tv_usec+t.tv_sec;
}
int usbGetStringAscii(usb_dev_handle *dev, int my_index,
int langid, char *buf, int buflen);
unsigned char Si570usbOpenDevice(usb_dev_handle **device, char *usbSerialID);
unsigned char Si570usbOpenDevice(libusb_device_handle **device, char *usbSerialID);
void setLongWord( int value, char * bytes);
int setFreqByValue(usb_dev_handle * handle, double frequency);
int setFreqByValue(libusb_device_handle * handle, double frequency);
void sweepa_freq(void);
void sweepm_freq(void);
@ -105,111 +96,105 @@ int set570(double freq_MHz)
return 0;
}
int usbGetStringAscii(usb_dev_handle *dev, int my_index,
int langid, char *buf, int buflen)
unsigned char Si570usbOpenDevice (libusb_device_handle * * udh, char * usbSerialID)
{
char buffer[256];
int rval, i;
if((rval = usb_control_msg(dev, USB_ENDPOINT_IN, USB_REQ_GET_DESCRIPTOR,
(USB_DT_STRING << 8) + my_index, langid, buffer,
sizeof(buffer), 1000)) < 0) return rval;
if(buffer[1] != USB_DT_STRING) return 0;
if((unsigned char)buffer[0] < rval) rval = (unsigned char)buffer[0];
rval /= 2;
// lossy conversion to ISO Latin1
for(i=1;i<rval;i++) {
if(i > buflen) break; // destination buffer overflow
buf[i-1] = buffer[2 * i];
if(buffer[2 * i + 1] != 0) buf[i-1] = '?'; // outside of ISO Latin1 range
}
buf[i-1] = 0;
return i-1;
}
// if (*udh) return USB_SUCCESS; // only scan USB devices 1st time
unsigned char Si570usbOpenDevice(usb_dev_handle **device, char *usbSerialID)
{
struct usb_bus *bus;
struct usb_device *dev;
usb_dev_handle *handle = NULL;
unsigned char errorCode = USB_ERROR_NOTFOUND;
char string[256];
int len;
int vendor = USBDEV_SHARED_VENDOR;
char *vendorName = (char *)VENDOR_NAME;
int product = USBDEV_SHARED_PRODUCT;
char *productName = (char *)PRODUCT_NAME;
char serialNumberString[20];
static int didUsbInit = 0;
if(!didUsbInit) {
didUsbInit = 1;
usb_init();
}
usb_find_busses();
usb_find_devices();
for(bus=usb_get_busses(); bus; bus=bus->next) {
for(dev=bus->devices; dev; dev=dev->next) {
if(dev->descriptor.idVendor == vendor &&
dev->descriptor.idProduct == product) {
handle = usb_open(dev); // open the device in order to query strings
if(!handle) {
errorCode = USB_ERROR_ACCESS;
printf("si570.c: Warning: cannot open Si570-USB device:\n");
printf("usb error message: %s\n",usb_strerror());
continue;
libusb_device_handle * handle = nullptr;
unsigned char errorCode = USB_ERROR_NOTFOUND;
char buffer[256];
int rc;
if ((rc = libusb_init (nullptr)) < 0) // init default context (safe to repeat)
{
printf ("usb initialization error message %s\n", libusb_error_name (rc));
return errorCode = USB_ERROR_ACCESS;
}
if(vendorName == NULL && productName == NULL) { //name does not matter
break;
libusb_device * * device_list;
int device_count = libusb_get_device_list (nullptr, &device_list);
if (device_count < 0)
{
puts ("no usb devices");
errorCode = USB_ERROR_NOTFOUND;
}
// now check whether the names match
len = usbGetStringAscii(handle, dev->descriptor.iManufacturer, 0x0409, string, sizeof(string));
if(len < 0) {
errorCode = USB_ERROR_IO;
printf("si570.c: Warning: cannot query manufacturer for Si570-USB device:\n");
printf("usb error message: %s\n",usb_strerror());
} else {
errorCode = USB_ERROR_NOTFOUND;
//fprintf(stderr, "seen device from vendor ->%s<-\n", string);
if(strcmp(string, vendorName) == 0){
len = usbGetStringAscii(handle, dev->descriptor.iProduct,
0x0409, string, sizeof(string));
if(len < 0) {
errorCode = USB_ERROR_IO;
printf("si570.c: Warning: cannot query product for Si570-USB device: \n");
printf("usb error message: %s\n",usb_strerror());
} else {
errorCode = USB_ERROR_NOTFOUND;
// fprintf(stderr, "seen product ->%s<-\n", string);
if(strcmp(string, productName) == 0) {
len = usbGetStringAscii(handle, dev->descriptor.iSerialNumber,
0x0409, serialNumberString, sizeof(serialNumberString));
if (len < 0) {
errorCode = USB_ERROR_IO;
printf("si570.c: Warning: cannot query serial number for Si570-USB device: \n");
printf("usb error message: %s\n",usb_strerror());
} else {
errorCode = USB_ERROR_NOTFOUND;
if ((usbSerialID == NULL) ||
(strcmp(serialNumberString, usbSerialID) == 0)) {
// printf("\nOpen Si570 USB device: OK\n");
// printf("usbSerialID : %s\n",serialNumberString);
break;
}
else
{
for (int i = 0; i < device_count; ++i)
{
libusb_device * device = device_list[i];
libusb_device_descriptor descriptor;
if ((rc = libusb_get_device_descriptor (device, &descriptor)) < 0)
{
printf ("usb get devive descriptor error message %s\n", libusb_error_name (rc));
errorCode = USB_ERROR_ACCESS;
continue;
}
if (vendor == descriptor.idVendor && product == descriptor.idProduct)
{
// now we must open the device to query strings
if ((rc = libusb_open (device, &handle)) < 0)
{
printf ("usb open device descriptor error message %s\n", libusb_error_name (rc));
errorCode = USB_ERROR_ACCESS;
continue;
}
if (!vendorName && !productName)
{
break; // good to go
}
if (libusb_get_string_descriptor_ascii (handle, descriptor.iManufacturer
, reinterpret_cast<unsigned char *> (buffer), sizeof buffer) < 0)
{
printf ("usb get vendor name error message %s\n", libusb_error_name (rc));
errorCode = USB_ERROR_IO;
}
else
{
if (!vendorName || !strcmp (buffer, vendorName))
{
if (libusb_get_string_descriptor_ascii (handle, descriptor.iProduct
, reinterpret_cast<unsigned char *> (buffer), sizeof buffer) < 0)
{
printf ("usb get product name error message %s\n", libusb_error_name (rc));
errorCode = USB_ERROR_IO;
}
else
{
if (!productName || !strcmp (buffer, productName))
{
if (libusb_get_string_descriptor_ascii (handle, descriptor.iSerialNumber
, reinterpret_cast<unsigned char *> (buffer), sizeof buffer) < 0)
{
printf ("usb get serial number error message %s\n", libusb_error_name (rc));
errorCode = USB_ERROR_IO;
}
else
{
if (!usbSerialID || !strcmp (buffer, usbSerialID))
{
break; // good to go
}
}
}
}
}
}
libusb_close (handle);
handle = nullptr;
}
}
}
}
}
libusb_free_device_list (device_list, 1);
}
usb_close(handle);
handle = NULL;
}
if (handle)
{
errorCode = USB_SUCCESS;
*udh = handle;
}
if(handle) break;
}
if(handle != NULL) {
errorCode = USB_SUCCESS;
*device = handle;
}
return errorCode;
}
@ -221,7 +206,7 @@ void setLongWord( int value, char * bytes)
bytes[3] = ((value & 0xff000000) >> 24) & 0xff;
}
int setFreqByValue(usb_dev_handle * handle, double frequency)
int setFreqByValue(libusb_device_handle * handle, double frequency)
{
// Windows Doc from PE0FKO:
//
@ -236,7 +221,7 @@ int setFreqByValue(usb_dev_handle * handle, double frequency)
// Default: None
//
// Parameters:
// requesttype: USB_ENDPOINT_OUT
// requesttype: LIBUSB_ENDPOINT_OUT
// request: 0x32
// value: 0
// index: 0
@ -264,14 +249,14 @@ int setFreqByValue(usb_dev_handle * handle, double frequency)
err_cnt =0;
set_again:;
setLongWord(round(frequency * 2097152.0), buffer); // 2097152=2^21
retval=usb_control_msg(
handle, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_OUT,
request,
value,
my_index,
buffer,
sizeof(buffer),
5000);
retval = libusb_control_transfer (
handle, LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE | LIBUSB_ENDPOINT_OUT,
request,
value,
my_index,
reinterpret_cast<unsigned char *> (buffer),
sizeof(buffer),
5000);
if (retval != 4) {
err_cnt ++;
if(err_cnt < MAX_USB_ERR_CNT) {
@ -279,7 +264,7 @@ int setFreqByValue(usb_dev_handle * handle, double frequency)
goto set_again;
} else {
printf("Error when setting frequency, returncode=%i\n",retval);
printf("usb error message: %s\n", usb_strerror());
printf("usb error message: %s\n", libusb_error_name (retval));
}
}
return retval;

View File

@ -29,7 +29,7 @@ SignalMeter::~SignalMeter()
void SignalMeter::paintEvent( QPaintEvent * )
{
QPainter p;
p.begin(this);
p.drawLine(22, 10, 22, 130);
for ( int i = 0; i <= 60; i += 10 ) {

View File

@ -331,9 +331,7 @@ void SoundInThread::inputUDP()
}
// Set this socket's total buffer space for received UDP packets
int v=141600;
::setsockopt(udpSocket->socketDescriptor(), SOL_SOCKET, SO_RCVBUF,
(char *)&v, sizeof(v));
udpSocket->setSocketOption (QUdpSocket::ReceiveBufferSizeSocketOption, 141600);
bool qe = quitExecution;
struct linradBuffer {

View File

@ -24,10 +24,10 @@ typedef struct //Parameters sent to or received from callback function
} paUserData;
//--------------------------------------------------------------- d2aCallback
extern "C" int d2aCallback(const void *inputBuffer, void *outputBuffer,
extern "C" int d2aCallback(const void * /*inputBuffer*/, void *outputBuffer,
unsigned long framesToProcess,
const PaStreamCallbackTimeInfo* timeInfo,
PaStreamCallbackFlags statusFlags,
const PaStreamCallbackTimeInfo* /*timeInfo*/,
PaStreamCallbackFlags /*statusFlags*/,
void *userData )
{
paUserData *udata=(paUserData*)userData;

View File

@ -37,44 +37,35 @@ void TxTune::reject()
void TxTune::on_pwrSlider_valueChanged(int n)
{
txPower=n;
QString t;
t.sprintf("%d %%",n);
ui->labPower->setText(t);
ui->labPower->setText (QString {"%1 %"}.arg (n));
}
void TxTune::on_ampSlider_valueChanged(int n)
{
m_iqAmp1=n;
iqAmp=10*m_iqAmp1 + m_iqAmp2;
QString t;
t.sprintf("%.4f",1.0 + 0.0001*iqAmp);
ui->labAmpReal->setText(t);
ui->labAmpReal->setText (QString::number (1.0 + 0.0001 * iqAmp, 'f', 4));
}
void TxTune::on_fineAmpSlider_valueChanged(int n)
{
m_iqAmp2=n;
iqAmp=10*m_iqAmp1 + m_iqAmp2;
QString t;
t.sprintf("%.4f",1.0 + 0.0001*iqAmp);
ui->labAmpReal->setText(t);}
ui->labAmpReal->setText (QString::number (1.0 + 0.0001*iqAmp, 'f', 4));
}
void TxTune::on_phaSlider_valueChanged(int n)
{
m_iqPha1=n;
iqPhase=10*m_iqPha1 + m_iqPha2;
QString t;
t.sprintf("%.2f",0.01*iqPhase);
ui->labPhaReal->setText(t);
ui->labPhaReal->setText (QString::number (0.01*iqPhase, 'f', 2));
}
void TxTune::on_finePhaSlider_valueChanged(int n)
{
m_iqPha2=n;
iqPhase=10*m_iqPha1 + m_iqPha2;
QString t;
t.sprintf("%.2f",0.01*iqPhase);
ui->labPhaReal->setText(t);
ui->labPhaReal->setText (QString::number (0.01*iqPhase, 'f', 2));
}
void TxTune::set_iqAmp(int n)

View File

@ -1,409 +0,0 @@
#ifndef __USB_H__
#define __USB_H__
#include <stdlib.h>
#include <windows.h>
/*
* 'interface' is defined somewhere in the Windows header files. This macro
* is deleted here to avoid conflicts and compile errors.
*/
#ifdef interface
#undef interface
#endif
/*
* PATH_MAX from limits.h can't be used on Windows if the dll and
* import libraries are build/used by different compilers
*/
#define LIBUSB_PATH_MAX 512
/*
* USB spec information
*
* This is all stuff grabbed from various USB specs and is pretty much
* not subject to change
*/
/*
* Device and/or Interface Class codes
*/
#define USB_CLASS_PER_INTERFACE 0 /* for DeviceClass */
#define USB_CLASS_AUDIO 1
#define USB_CLASS_COMM 2
#define USB_CLASS_HID 3
#define USB_CLASS_PRINTER 7
#define USB_CLASS_MASS_STORAGE 8
#define USB_CLASS_HUB 9
#define USB_CLASS_DATA 10
#define USB_CLASS_VENDOR_SPEC 0xff
/*
* Descriptor types
*/
#define USB_DT_DEVICE 0x01
#define USB_DT_CONFIG 0x02
#define USB_DT_STRING 0x03
#define USB_DT_INTERFACE 0x04
#define USB_DT_ENDPOINT 0x05
#define USB_DT_HID 0x21
#define USB_DT_REPORT 0x22
#define USB_DT_PHYSICAL 0x23
#define USB_DT_HUB 0x29
/*
* Descriptor sizes per descriptor type
*/
#define USB_DT_DEVICE_SIZE 18
#define USB_DT_CONFIG_SIZE 9
#define USB_DT_INTERFACE_SIZE 9
#define USB_DT_ENDPOINT_SIZE 7
#define USB_DT_ENDPOINT_AUDIO_SIZE 9 /* Audio extension */
#define USB_DT_HUB_NONVAR_SIZE 7
/* ensure byte-packed structures */
#include <pshpack1.h>
/* All standard descriptors have these 2 fields in common */
struct usb_descriptor_header
{
unsigned char bLength;
unsigned char bDescriptorType;
};
/* String descriptor */
struct usb_string_descriptor
{
unsigned char bLength;
unsigned char bDescriptorType;
unsigned short wData[1];
};
/* HID descriptor */
struct usb_hid_descriptor
{
unsigned char bLength;
unsigned char bDescriptorType;
unsigned short bcdHID;
unsigned char bCountryCode;
unsigned char bNumDescriptors;
};
/* Endpoint descriptor */
#define USB_MAXENDPOINTS 32
struct usb_endpoint_descriptor
{
unsigned char bLength;
unsigned char bDescriptorType;
unsigned char bEndpointAddress;
unsigned char bmAttributes;
unsigned short wMaxPacketSize;
unsigned char bInterval;
unsigned char bRefresh;
unsigned char bSynchAddress;
unsigned char *extra; /* Extra descriptors */
int extralen;
};
#define USB_ENDPOINT_ADDRESS_MASK 0x0f /* in bEndpointAddress */
#define USB_ENDPOINT_DIR_MASK 0x80
#define USB_ENDPOINT_TYPE_MASK 0x03 /* in bmAttributes */
#define USB_ENDPOINT_TYPE_CONTROL 0
#define USB_ENDPOINT_TYPE_ISOCHRONOUS 1
#define USB_ENDPOINT_TYPE_BULK 2
#define USB_ENDPOINT_TYPE_INTERRUPT 3
/* Interface descriptor */
#define USB_MAXINTERFACES 32
struct usb_interface_descriptor
{
unsigned char bLength;
unsigned char bDescriptorType;
unsigned char bInterfaceNumber;
unsigned char bAlternateSetting;
unsigned char bNumEndpoints;
unsigned char bInterfaceClass;
unsigned char bInterfaceSubClass;
unsigned char bInterfaceProtocol;
unsigned char iInterface;
struct usb_endpoint_descriptor *endpoint;
unsigned char *extra; /* Extra descriptors */
int extralen;
};
#define USB_MAXALTSETTING 128 /* Hard limit */
struct usb_interface
{
struct usb_interface_descriptor *altsetting;
int num_altsetting;
};
/* Configuration descriptor information.. */
#define USB_MAXCONFIG 8
struct usb_config_descriptor
{
unsigned char bLength;
unsigned char bDescriptorType;
unsigned short wTotalLength;
unsigned char bNumInterfaces;
unsigned char bConfigurationValue;
unsigned char iConfiguration;
unsigned char bmAttributes;
unsigned char MaxPower;
struct usb_interface *interface;
unsigned char *extra; /* Extra descriptors */
int extralen;
};
/* Device descriptor */
struct usb_device_descriptor
{
unsigned char bLength;
unsigned char bDescriptorType;
unsigned short bcdUSB;
unsigned char bDeviceClass;
unsigned char bDeviceSubClass;
unsigned char bDeviceProtocol;
unsigned char bMaxPacketSize0;
unsigned short idVendor;
unsigned short idProduct;
unsigned short bcdDevice;
unsigned char iManufacturer;
unsigned char iProduct;
unsigned char iSerialNumber;
unsigned char bNumConfigurations;
};
struct usb_ctrl_setup
{
unsigned char bRequestType;
unsigned char bRequest;
unsigned short wValue;
unsigned short wIndex;
unsigned short wLength;
};
/*
* Standard requests
*/
#define USB_REQ_GET_STATUS 0x00
#define USB_REQ_CLEAR_FEATURE 0x01
/* 0x02 is reserved */
#define USB_REQ_SET_FEATURE 0x03
/* 0x04 is reserved */
#define USB_REQ_SET_ADDRESS 0x05
#define USB_REQ_GET_DESCRIPTOR 0x06
#define USB_REQ_SET_DESCRIPTOR 0x07
#define USB_REQ_GET_CONFIGURATION 0x08
#define USB_REQ_SET_CONFIGURATION 0x09
#define USB_REQ_GET_INTERFACE 0x0A
#define USB_REQ_SET_INTERFACE 0x0B
#define USB_REQ_SYNCH_FRAME 0x0C
#define USB_TYPE_STANDARD (0x00 << 5)
#define USB_TYPE_CLASS (0x01 << 5)
#define USB_TYPE_VENDOR (0x02 << 5)
#define USB_TYPE_RESERVED (0x03 << 5)
#define USB_RECIP_DEVICE 0x00
#define USB_RECIP_INTERFACE 0x01
#define USB_RECIP_ENDPOINT 0x02
#define USB_RECIP_OTHER 0x03
/*
* Various libusb API related stuff
*/
#define USB_ENDPOINT_IN 0x80
#define USB_ENDPOINT_OUT 0x00
/* Error codes */
#define USB_ERROR_BEGIN 500000
/*
* This is supposed to look weird. This file is generated from autoconf
* and I didn't want to make this too complicated.
*/
#define USB_LE16_TO_CPU(x)
/* Data types */
/* struct usb_device; */
/* struct usb_bus; */
struct usb_device
{
struct usb_device *next, *prev;
char filename[LIBUSB_PATH_MAX];
struct usb_bus *bus;
struct usb_device_descriptor descriptor;
struct usb_config_descriptor *config;
void *dev; /* Darwin support */
unsigned char devnum;
unsigned char num_children;
struct usb_device **children;
};
struct usb_bus
{
struct usb_bus *next, *prev;
char dirname[LIBUSB_PATH_MAX];
struct usb_device *devices;
unsigned long location;
struct usb_device *root_dev;
};
/* Version information, Windows specific */
struct usb_version
{
struct
{
int major;
int minor;
int micro;
int nano;
} dll;
struct
{
int major;
int minor;
int micro;
int nano;
} driver;
};
struct usb_dev_handle;
typedef struct usb_dev_handle usb_dev_handle;
/* Variables */
#ifndef __USB_C__
#define usb_busses usb_get_busses()
#endif
#include <poppack.h>
#ifdef __cplusplus
extern "C"
{
#endif
/* Function prototypes */
/* usb.c */
usb_dev_handle *usb_open(struct usb_device *dev);
int usb_close(usb_dev_handle *dev);
int usb_get_string(usb_dev_handle *dev, int index, int langid, char *buf,
size_t buflen);
int usb_get_string_simple(usb_dev_handle *dev, int index, char *buf,
size_t buflen);
/* descriptors.c */
int usb_get_descriptor_by_endpoint(usb_dev_handle *udev, int ep,
unsigned char type, unsigned char index,
void *buf, int size);
int usb_get_descriptor(usb_dev_handle *udev, unsigned char type,
unsigned char index, void *buf, int size);
/* <arch>.c */
int usb_bulk_write(usb_dev_handle *dev, int ep, char *bytes, int size,
int timeout);
int usb_bulk_read(usb_dev_handle *dev, int ep, char *bytes, int size,
int timeout);
int usb_interrupt_write(usb_dev_handle *dev, int ep, char *bytes, int size,
int timeout);
int usb_interrupt_read(usb_dev_handle *dev, int ep, char *bytes, int size,
int timeout);
int usb_control_msg(usb_dev_handle *dev, int requesttype, int request,
int value, int index, char *bytes, int size,
int timeout);
int usb_set_configuration(usb_dev_handle *dev, int configuration);
int usb_claim_interface(usb_dev_handle *dev, int interface);
int usb_release_interface(usb_dev_handle *dev, int interface);
int usb_set_altinterface(usb_dev_handle *dev, int alternate);
int usb_resetep(usb_dev_handle *dev, unsigned int ep);
int usb_clear_halt(usb_dev_handle *dev, unsigned int ep);
int usb_reset(usb_dev_handle *dev);
char *usb_strerror(void);
void usb_init(void);
void usb_set_debug(int level);
int usb_find_busses(void);
int usb_find_devices(void);
struct usb_device *usb_device(usb_dev_handle *dev);
struct usb_bus *usb_get_busses(void);
/* Windows specific functions */
#define LIBUSB_HAS_INSTALL_SERVICE_NP 1
int usb_install_service_np(void);
void CALLBACK usb_install_service_np_rundll(HWND wnd, HINSTANCE instance,
LPSTR cmd_line, int cmd_show);
#define LIBUSB_HAS_UNINSTALL_SERVICE_NP 1
int usb_uninstall_service_np(void);
void CALLBACK usb_uninstall_service_np_rundll(HWND wnd, HINSTANCE instance,
LPSTR cmd_line, int cmd_show);
#define LIBUSB_HAS_INSTALL_DRIVER_NP 1
int usb_install_driver_np(const char *inf_file);
void CALLBACK usb_install_driver_np_rundll(HWND wnd, HINSTANCE instance,
LPSTR cmd_line, int cmd_show);
#define LIBUSB_HAS_TOUCH_INF_FILE_NP 1
int usb_touch_inf_file_np(const char *inf_file);
void CALLBACK usb_touch_inf_file_np_rundll(HWND wnd, HINSTANCE instance,
LPSTR cmd_line, int cmd_show);
#define LIBUSB_HAS_INSTALL_NEEDS_RESTART_NP 1
int usb_install_needs_restart_np(void);
const struct usb_version *usb_get_version(void);
int usb_isochronous_setup_async(usb_dev_handle *dev, void **context,
unsigned char ep, int pktsize);
int usb_bulk_setup_async(usb_dev_handle *dev, void **context,
unsigned char ep);
int usb_interrupt_setup_async(usb_dev_handle *dev, void **context,
unsigned char ep);
int usb_submit_async(void *context, char *bytes, int size);
int usb_reap_async(void *context, int timeout);
int usb_reap_async_nocancel(void *context, int timeout);
int usb_cancel_async(void *context);
int usb_free_async(void **context);
#ifdef __cplusplus
}
#endif
#endif /* __USB_H__ */

View File

@ -380,14 +380,9 @@ void WideGraph::tx570()
void WideGraph::updateFreqLabel()
{
double rxFreq=ui->widePlot->rxFreq();
double txFreq=ui->widePlot->txFreq();
QString t;
t.sprintf("Rx: %10.6f",rxFreq);
QString t1=t.mid(0,12) + "." + t.mid(12,3);
t.sprintf("Tx: %10.6f",txFreq);
QString t2=t.mid(0,12) + "." + t.mid(12,3);
ui->labFreq->setText(t1 + "\n" + t2);
auto rxFreq = QString {"%1"}.arg (ui->widePlot->rxFreq (), 10, 'f', 6).insert (7, '.');
auto txFreq = QString {"%1"}.arg (ui->widePlot->txFreq (), 10, 'f', 6).insert (7, '.');
ui->labFreq->setText (QString {"Rx: %1\nTx: %2"}.arg (rxFreq, txFreq));
}
void WideGraph::enableSetRxHardware(bool b)