/** * @file sensors.h * @author Alexander Klein (alex@kleiax.de) * @brief * @version 0.1 * @date 2023-09-02 * * @copyright Copyright (c) 2023 * */ #ifndef SENSORS_H #define SENSORS_H #include #include //Sensors #include #include // Gyroskop #include "component.h" #include "sensorData.h" #include "calibrateCompass.h" class Sensors : public Component { public: enum CalcAzimuthState { Invalid, Bad, Ok, Good, Super }; Sensors(); void run() override; void runAsChild() override; void enableGnss(SPIClass* spiPort, uint8_t csPin); void enableGnss(); void enableCompass(); void enableGyroskop(); /** * @brief Set the output status for PVTdata. * * If this is true, a lot of information from the gnss module will be printed in * the interval of navigation frequency. * * @param status */ static void setOutputStatusPrintPVTdata(bool status); private: void initGnss(); QMC5883LCompass* compass = nullptr; SFE_UBLOX_GNSS* gnss = nullptr; CalcAzimuthState calcAzimuthState = CalcAzimuthState::Invalid; int16_t realAzimuth = INT16_MAX; static void printPVTdata(UBX_NAV_PVT_data_t *ubxDataStruct); static void savePVTdata(UBX_NAV_PVT_data_t *ubxDataStruct); static UBX_NAV_PVT_data_t* ubxDataStatic; static uint32_t ubxUpdateTimeStatic; static bool outputStatusPrintPVTdata; static bool newData; }; #endif // SENSORS_H