Fix squelch timing

This commit is contained in:
Ezra Taimuty-Loomis 2020-04-29 14:41:15 -04:00
parent 8153525b08
commit d0e6a0887a
7 changed files with 18 additions and 10 deletions

View File

@ -3,7 +3,7 @@ cmake_minimum_required (VERSION 2.6)
project (piScan_backend)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wextra")
set(CMAKE_BUILD_TYPE Debug)
add_executable(piScan_backend piScan_backend.cpp)

View File

@ -19,6 +19,7 @@ public:
bool stopSystem();
const SystemInfo getSystemInfo();
inline Configuration& getConfig() { return Configuration::getConfig(); };
void softAbort();
/* scanner functions */
void startScan();

View File

@ -213,7 +213,7 @@ void ScannerSM::ST_Hold(EventData* data){
else if(_currentEntry->delayMS()){
auto current = time_point_cast<milliseconds>(system_clock::now());
if((current- timeoutStart).count() < _currentEntry->delayMS()){
if(std::chrono::duration_cast<std::chrono::duration<int, std::milli>>(current- timeoutStart).count() < _currentEntry->delayMS()){
InternalEvent(ST_HOLD);
}
else if(!evtSrcExternal){

View File

@ -210,6 +210,9 @@ void DemodulatorThread::run() {
bool squelched = squelchEnabled && (signalLevel < squelchLevel);
//
signalLevel = currentSignalLevel;
if (squelchEnabled) {
if (!squelched && !squelchBreak) {
if (wxGetApp().getSoloMode() /*&& !wxGetApp().getAppFrame()->isUserDemodBusy()*/) {

View File

@ -103,7 +103,7 @@ bool SDRThread::init() {
if (!stream) {
wxGetApp().sdrThreadNotify(SDRThread::SDR_THREAD_FAILED, std::string("Stream setup failed, stream is null. ") + streamExceptionStr);
//std::cout << "Stream setup failed, stream is null. " << streamExceptionStr << std::endl;
LOG_F(ERROR, "Stream setup failed, stream is null");
ABORT_F("Stream setup failed, stream is null");
return false;
}

View File

@ -290,23 +290,27 @@ static SystemController sysControl(messageManager, scanSystems, scanner, connect
static std::atomic_bool steadyState(false);
void terminate(){
void hardTerminate(){
LOG_F(WARNING, "Terminating - resources may not be properly released");
std::terminate();
}
void sigTermHandler(int signal){
sysRun = false;
//exit(1);
piscan::terminate();
// SIGTERM is raised by the kernel during shutdown
if(sysRun){
app::stopSystem();
sysRun = false;
}
// SIGTERM called after exit process has started - possibly because the program locked up and the user wants to force quit
else
piscan::hardTerminate();
}
void sigIntHandler(int signal){
LOG_F(INFO, "Stop triggered by interrupt");
if(!sysRun)
piscan::terminate();
piscan::hardTerminate();
sysRun = false;
}

View File

@ -251,8 +251,8 @@ void ServerManager::_handleMessage(std::shared_ptr<Message> message){
case ServerMessage::SIGNAL_LEVEL:
DLOG_F(7, "Broadcast siglevel update");
level = *(reinterpret_cast<int*>(msg->pData));
delete msg->pData;
_broadcastSignalLevelUpdate(level);
delete &level;
break;
default:
break;