2019-07-23 Fred Gleason <fredg@paravelsystems.com>

* Fixed regressions that made serial device operation unreliable.
This commit is contained in:
Fred Gleason
2019-07-23 14:19:06 -04:00
parent 70c88ec498
commit c3cc94143a
29 changed files with 216 additions and 217 deletions

View File

@@ -2,7 +2,7 @@
//
// A Rivendell switcher driver for the BroadcastTools SS 16.4
//
// (C) Copyright 2002-2005,2016-2018 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2019 Fred Gleason <fredg@paravelsystems.com>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
@@ -149,12 +149,12 @@ void BtSs164::processCommand(RDMacro *cmd)
if(cmd->arg(1).lower()=="o") {
if(cmd->arg(2).toInt()<8) {
sprintf(str,"*%dOR%dF",BTSS164_UNIT_ID,cmd->arg(2).toInt());
bt_device->writeBlock(str,6);
bt_device->write(str,6);
}
else {
sprintf(str,"*%dOOR%02dF",BTSS164_UNIT_ID,
cmd->arg(2).toInt()-8);
bt_device->writeBlock(str,8);
bt_device->write(str,8);
}
emit gpoChanged(bt_matrix,cmd->arg(2).toInt()-1,false);
}
@@ -170,7 +170,7 @@ void BtSs164::processCommand(RDMacro *cmd)
else {
if(cmd->arg(3).toInt()==-1) { // Clear input
bt_gpi_mask[cmd->arg(2).toInt()-1]=false;
bt_device->writeBlock("*0SPA",5);
bt_device->write("*0SPA",5);
}
else {
if(cmd->arg(4).toInt()==0) { // Turn ON
@@ -184,12 +184,12 @@ void BtSs164::processCommand(RDMacro *cmd)
if(cmd->arg(1).lower()=="o") {
if(cmd->arg(2).toInt()<8) {
sprintf(str,"*%dOR%dL",BTSS164_UNIT_ID,cmd->arg(2).toInt());
bt_device->writeBlock(str,6);
bt_device->write(str,6);
}
else {
sprintf(str,"*%dOOR%02dL",BTSS164_UNIT_ID,
cmd->arg(2).toInt()-8);
bt_device->writeBlock(str,8);
bt_device->write(str,8);
}
emit gpoChanged(bt_matrix,cmd->arg(2).toInt()-1,true);
}
@@ -206,12 +206,12 @@ void BtSs164::processCommand(RDMacro *cmd)
if(cmd->arg(1).lower()=="o") {
if(cmd->arg(2).toInt()<8) {
sprintf(str,"*%dOR%dP",BTSS164_UNIT_ID,cmd->arg(2).toInt());
bt_device->writeBlock(str,6);
bt_device->write(str,6);
}
else {
sprintf(str,"*%dOOR%02dP",BTSS164_UNIT_ID,
cmd->arg(2).toInt()-8);
bt_device->writeBlock(str,8);
bt_device->write(str,8);
}
emit gpoChanged(bt_matrix,cmd->arg(2).toInt()-1,true);
bt_gpo_oneshot->start(cmd->arg(2).toInt()-1,500);
@@ -234,7 +234,7 @@ void BtSs164::processCommand(RDMacro *cmd)
}
sprintf(str,"*%d%02d%d",BTSS164_UNIT_ID,
cmd->arg(1).toInt(),cmd->arg(2).toInt());
bt_device->writeBlock(str,5);
bt_device->write(str,5);
cmd->acknowledge(true);
emit rmlEcho(cmd);
break;
@@ -248,7 +248,7 @@ void BtSs164::processCommand(RDMacro *cmd)
}
sprintf(str,"*%d%02dM%d",BTSS164_UNIT_ID,
cmd->arg(1).toInt(),cmd->arg(2).toInt());
bt_device->writeBlock(str,6);
bt_device->write(str,6);
cmd->acknowledge(true);
emit rmlEcho(cmd);
break;
@@ -262,14 +262,14 @@ void BtSs164::processCommand(RDMacro *cmd)
}
if(cmd->arg(1).toInt()==0) {
sprintf(str,"*%dM%d",BTSS164_UNIT_ID,cmd->arg(2).toInt());
bt_device->writeBlock(str,4);
bt_device->write(str,4);
}
else {
sprintf(str,"*%dM%d",BTSS164_UNIT_ID,cmd->arg(2).toInt());
bt_device->writeBlock(str,4);
bt_device->write(str,4);
sprintf(str,"*%d%02d%d",BTSS164_UNIT_ID,
cmd->arg(1).toInt(),cmd->arg(2).toInt());
bt_device->writeBlock(str,5);
bt_device->write(str,5);
}
cmd->acknowledge(true);
emit rmlEcho(cmd);
@@ -289,7 +289,7 @@ void BtSs164::processStatus()
int n;
int gpi;
while((n=bt_device->readBlock(buffer,255))>0) {
while((n=bt_device->read(buffer,255))>0) {
for(int i=0;i<n;i++) {
switch(bt_istate) {
case 0:
@@ -419,7 +419,7 @@ void BtSs164::processStatus()
void BtSs164::gpiOneshotData(int value)
{
bt_gpi_mask[value]=false;
bt_device->writeBlock("*0SPA",5);
bt_device->write("*0SPA",5);
}