-
-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Not tested with a real telemetry source yet. This does not require any setting to change the telemetry protocol in use, because the ground station uses different ports already, we just listen on each of them in the different telemetry classes and everything will just work. Ref: #17
- Loading branch information
1 parent
1896943
commit b9fa55b
Showing
7 changed files
with
464 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
#ifndef VECTORTELEMETRY_H | ||
#define VECTORTELEMETRY_H | ||
|
||
#include <QObject> | ||
#include <QtQuick> | ||
|
||
#include "constants.h" | ||
|
||
|
||
enum _serial_state { | ||
IDLE, | ||
HEADER_START1, | ||
HEADER_START2, | ||
HEADER_START3, | ||
HEADER_START4, | ||
HEADER_MSGTYPE | ||
}; | ||
|
||
class QUdpSocket; | ||
|
||
class VectorTelemetry: public QObject { | ||
Q_OBJECT | ||
|
||
public: | ||
explicit VectorTelemetry(QObject *parent = nullptr); | ||
|
||
|
||
Q_PROPERTY(QString last_heartbeat MEMBER m_last_heartbeat WRITE set_last_heartbeat NOTIFY last_heartbeat_changed) | ||
void set_last_heartbeat(QString last_heartbeat); | ||
|
||
signals: | ||
void last_heartbeat_changed(QString last_heartbeat); | ||
|
||
|
||
private slots: | ||
#if defined(__rasp_pi__) | ||
void processVectorFifo(); | ||
void restartFifo(); | ||
#else | ||
void processVectorDatagrams(); | ||
#endif | ||
|
||
private: | ||
void init(); | ||
|
||
uint8_t votread_u8(); | ||
uint16_t votread_u16(); | ||
uint16_t votbread_u16(); | ||
uint32_t votread_u32(); | ||
uint32_t votbread_u32(); | ||
uint16_t CRC16Worker(uint16_t icrc, uint8_t r0); | ||
uint16_t CalculateCRC(uint8_t * pPacket, uint8_t Size, uint16_t InitCRC); | ||
void vot_read(uint8_t *buf, uint8_t buflen); | ||
|
||
|
||
void processVectorMessage(); | ||
|
||
#if defined(__rasp_pi__) | ||
QFuture<void> fifoFuture; | ||
QFutureWatcher<void> watcher; | ||
#else | ||
QUdpSocket *vectorSocket = nullptr; | ||
#endif | ||
|
||
QString m_last_heartbeat = "N/A"; | ||
qint64 last_heartbeat_timestamp; | ||
|
||
|
||
enum _serial_state c_state = IDLE; | ||
|
||
uint8_t VOTReceiverIndex; | ||
uint8_t VOTReadIndex; | ||
uint16_t VOTRcvChecksum; | ||
}; | ||
|
||
#endif //VECTORTELEMETRY_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.