promt improved

This commit is contained in:
Tristan Krause 2019-04-05 14:33:15 +02:00
parent 24688ff183
commit e0a4be7685
14 changed files with 91 additions and 29 deletions

View file

@ -55,8 +55,6 @@ void B15F::init()
void B15F::reconnect()
{
std::cout << PRE << "Verbindung unterbrochen, stelle Verbindung neu her: " << std::flush;
uint8_t tries = RECONNECT_TRIES;
while(tries--)
{
@ -228,6 +226,8 @@ uint16_t B15F::analogRead(uint8_t channel)
usart.writeByte(RQ_ADC);
usart.writeByte(channel);
uint16_t adc = usart.readInt();
if(adc > 1023)
throw DriverException("Bad ADC data detected");
delay_us(1);
return adc;
}
@ -251,7 +251,7 @@ void B15F::analogSequence(uint8_t channel_a, uint16_t* buffer_a, uint32_t offset
buffer_a[i] = usart.readInt();
buffer_b[i] = usart.readInt();
if(buffer_a[i] > 1023 || buffer_b[i] > 1023)
std::cout << PRE << "bad data detected" << std::endl;
throw DriverException("Bad ADC data detected");
}
uint8_t aw = usart.readByte();