added inital serial port flush, serial handeling changes. rate display bugfix
This commit is contained in:
30
main.cpp
30
main.cpp
@ -33,38 +33,11 @@ static void printUsage()
|
||||
-s, --sinkless run without serial port\n";
|
||||
}
|
||||
|
||||
static void printRates()
|
||||
{
|
||||
std::cout<<"Rates:\n\
|
||||
B50 0000001\n\
|
||||
B75 0000002\n\
|
||||
B110 0000003\n\
|
||||
B134 0000004\n\
|
||||
B150 0000005\n\
|
||||
B200 0000006\n\
|
||||
B300 0000007\n\
|
||||
B600 0000010\n\
|
||||
B1200 0000011\n\
|
||||
B1800 0000012\n\
|
||||
B2400 0000013\n\
|
||||
B4800 0000014\n\
|
||||
B9600 0000015\n\
|
||||
B19200 0000016\n\
|
||||
B38400 0000017\n\
|
||||
B57600 0010001\n\
|
||||
B115200 0010002\n\
|
||||
B500000 0010005\n\
|
||||
B1000000 0010010\n\
|
||||
B1152000 0010011\n\
|
||||
B1500000 0010012\n\
|
||||
B2000000 0010013\n";
|
||||
}
|
||||
|
||||
struct Config
|
||||
{
|
||||
std::string portFileName = "/dev/ttyUSB0";
|
||||
unsigned short port = 6856;
|
||||
int baud = 0000017;
|
||||
int baud = B9600;
|
||||
bool noSerial = false;
|
||||
};
|
||||
|
||||
@ -135,6 +108,7 @@ int main(int argc, char* argv[])
|
||||
std::cout<<"Using serial port: "<<config.portFileName<<" at "<<config.baud<<" baud\n";
|
||||
serial = serialport_init(config.portFileName.c_str(), config.baud);
|
||||
if(serial == -1) return 1;
|
||||
tcflush(serial, TCIOFLUSH);
|
||||
}
|
||||
else std::cout<<"Sinkless mode\n";
|
||||
|
||||
|
Reference in New Issue
Block a user