12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- #pragma once
- #ifdef WITH_SITL_OSD
- #include <AP_OSD/AP_OSD_Backend.h>
- #ifdef HAVE_SFML_GRAPHICS_H
- #include <SFML/Graphics.h>
- #else
- #include <SFML/Graphics.hpp>
- #endif
- class AP_OSD_SITL : public AP_OSD_Backend {
- public:
- static AP_OSD_Backend *probe(AP_OSD &osd);
-
- void write(uint8_t x, uint8_t y, const char* text) override;
-
- bool init() override;
-
- void flush() override;
-
- void clear() override;
- private:
-
- AP_OSD_SITL(AP_OSD &osd);
- sf::RenderWindow *w;
- sf::Texture font[256];
- uint8_t last_font;
-
- static const uint8_t char_width = 12;
- static const uint8_t char_height = 18;
- static const uint8_t video_lines = 16;
- static const uint8_t video_cols = 30;
- static const uint8_t char_spacing = 0;
-
- static const uint8_t char_scale = 2;
- uint8_t buffer[video_lines][video_cols];
- void update_thread();
- static void *update_thread_start(void *obj);
- void load_font();
- pthread_t thread;
- HAL_Semaphore mutex;
- uint32_t counter;
- uint32_t last_counter;
- };
- #endif
|