save bevor debug
This commit is contained in:
parent
2a8e3061db
commit
c1564064ac
10 changed files with 88 additions and 28 deletions
13
drv/b15f.cpp
13
drv/b15f.cpp
|
@ -4,6 +4,7 @@ B15F* B15F::instance = nullptr;
|
|||
|
||||
B15F::B15F()
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
void B15F::init()
|
||||
|
@ -262,7 +263,7 @@ uint16_t B15F::analogRead(uint8_t channel)
|
|||
}
|
||||
}
|
||||
|
||||
bool B15F::analogEingabeSequenz(uint8_t channel_a, uint16_t* buffer_a, uint32_t offset_a, uint8_t channel_b, uint16_t* buffer_b, uint32_t offset_b, uint16_t start, int16_t delta, uint16_t count)
|
||||
bool B15F::analogSequence(uint8_t channel_a, uint16_t* buffer_a, uint32_t offset_a, uint8_t channel_b, uint16_t* buffer_b, uint32_t offset_b, uint16_t start, int16_t delta, uint16_t count)
|
||||
{
|
||||
|
||||
discard();
|
||||
|
@ -280,10 +281,10 @@ bool B15F::analogEingabeSequenz(uint8_t channel_a, uint16_t* buffer_a, uint32_t
|
|||
if(aw != MSG_OK)
|
||||
{
|
||||
std::cout << PRE << "Out of sync" << std::endl;
|
||||
return analogEingabeSequenz(channel_a, buffer_a, offset_a, channel_b, buffer_b, offset_b, start, delta, count);
|
||||
return analogSequence(channel_a, buffer_a, offset_a, channel_b, buffer_b, offset_b, start, delta, count);
|
||||
}
|
||||
|
||||
uint8_t block[4];
|
||||
uint8_t block[5]; // 4 Datenbyte + crc
|
||||
for(uint16_t i = 0; i < count; i++)
|
||||
{
|
||||
bool crc_ok = readBlock(&block[0], 0);
|
||||
|
@ -291,7 +292,7 @@ bool B15F::analogEingabeSequenz(uint8_t channel_a, uint16_t* buffer_a, uint32_t
|
|||
if (!crc_ok)
|
||||
{
|
||||
std::cout << PRE << "bad crc" << std::endl;
|
||||
return analogEingabeSequenz(channel_a, buffer_a, offset_a, channel_b, buffer_b, offset_b, start, delta, count);
|
||||
return analogSequence(channel_a, buffer_a, offset_a, channel_b, buffer_b, offset_b, start, delta, count);
|
||||
}
|
||||
|
||||
|
||||
|
@ -304,12 +305,12 @@ bool B15F::analogEingabeSequenz(uint8_t channel_a, uint16_t* buffer_a, uint32_t
|
|||
return aw;
|
||||
|
||||
std::cout << PRE << "Da ging etwas verloren" << std::endl;
|
||||
return analogEingabeSequenz(channel_a, buffer_a, offset_a, channel_b, buffer_b, offset_b, start, delta, count);
|
||||
return analogSequence(channel_a, buffer_a, offset_a, channel_b, buffer_b, offset_b, start, delta, count);
|
||||
}
|
||||
catch(DriverException& de)
|
||||
{
|
||||
reconnect();
|
||||
return analogEingabeSequenz(channel_a, buffer_a, offset_a, channel_b, buffer_b, offset_b, start, delta, count);
|
||||
return analogSequence(channel_a, buffer_a, offset_a, channel_b, buffer_b, offset_b, start, delta, count);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ public:
|
|||
bool analogWrite0(uint16_t);
|
||||
bool analogWrite1(uint16_t);
|
||||
uint16_t analogRead(uint8_t);
|
||||
bool analogEingabeSequenz(uint8_t channel_a, uint16_t* buffer_a, uint32_t offset_a, uint8_t channel_b, uint16_t* buffer_b, uint32_t offset_b, uint16_t start, int16_t delta, uint16_t count);
|
||||
bool analogSequence(uint8_t channel_a, uint16_t* buffer_a, uint32_t offset_a, uint8_t channel_b, uint16_t* buffer_b, uint32_t offset_b, uint16_t start, int16_t delta, uint16_t count);
|
||||
|
||||
// Serielle Verbindung
|
||||
inline void writeByte(uint8_t);
|
||||
|
@ -53,7 +53,7 @@ public:
|
|||
|
||||
private:
|
||||
int usart = -1;
|
||||
uint16_t timeout = 32; // ms
|
||||
uint16_t timeout = 100; // ms
|
||||
uint16_t block_timeout = 1; // ms
|
||||
int TEST = 0;
|
||||
|
||||
|
@ -66,7 +66,7 @@ private:
|
|||
constexpr static uint8_t MSG_FAIL = 0xFE;
|
||||
constexpr static uint16_t RECONNECT_TIMEOUT = 64; // ms
|
||||
constexpr static uint8_t RECONNECT_TRIES = 3;
|
||||
constexpr static uint32_t BAUDRATE = 115200;
|
||||
constexpr static uint32_t BAUDRATE = 38400;
|
||||
constexpr static uint8_t CRC7_POLY = 0x91;
|
||||
|
||||
// REQUESTS
|
||||
|
|
BIN
drv/b15f.o
BIN
drv/b15f.o
Binary file not shown.
|
@ -189,3 +189,10 @@ void PlottyFile::writeToFile(std::string filename)
|
|||
|
||||
file.close();
|
||||
}
|
||||
|
||||
void PlottyFile::startPlotty(std::string filename)
|
||||
{
|
||||
int code = system(("./plotty --in " + filename).c_str());
|
||||
if(code)
|
||||
throw std::runtime_error("Fehler beim Aufruf von plotty");
|
||||
}
|
||||
|
|
|
@ -47,6 +47,7 @@ public:
|
|||
std::string getDescPara(void) const;
|
||||
|
||||
void writeToFile(std::string filename);
|
||||
void startPlotty(std::string filename);
|
||||
private:
|
||||
void prepStr(std::string& str, uint8_t len);
|
||||
|
||||
|
|
BIN
drv/plottyfile.o
BIN
drv/plottyfile.o
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue