Michal Fratczak 2020-04-23 18:31:31 +02:00
rodzic 1d4ae602f7
commit 0197f1b6f0
3 zmienionych plików z 9 dodań i 4 usunięć

Wyświetl plik

@ -219,7 +219,7 @@ int main1(int argc, char** argv)
GLOB::get().nmea_set(current_nmea); GLOB::get().nmea_set(current_nmea);
GLOB::get().gps_fix_now(); // typical time since uBlox msg read to here is under 1 millisecond GLOB::get().gps_fix_now(); // typical time since uBlox msg read to here is under 1 millisecond
GLOB::get().dynamics_add("alt", std::chrono::steady_clock::now(), current_nmea.alt); GLOB::get().dynamics_add("alt", std::chrono::steady_clock::now(), current_nmea.alt);
cout<<C_MAGENTA<<"alt "<<GLOB::get().dynamics_get("alt").str()<<C_OFF<<endl; // cout<<C_MAGENTA<<"alt "<<GLOB::get().dynamics_get("alt").str()<<C_OFF<<endl;
} }
} }
} }
@ -314,7 +314,10 @@ int main1(int argc, char** argv)
if( ssdv_tiles.size() ) if( ssdv_tiles.size() )
{ {
auto tile = ssdv_tiles.next_tile(); auto tile = ssdv_tiles.next_tile();
cout<<"Send SSDV @RF"<<endl; cout<<"Send SSDV @RF. Left tiles: "<<ssdv_tiles.size()<<endl;
// for(int i=0; i<256; ++i)
// cout<<" 0x"<<hex<<(int)(tile[i]);
// cout<<dec<<endl;
mtx2_write( radio_fd, tile.data(), sizeof(tile) ); mtx2_write( radio_fd, tile.data(), sizeof(tile) );
if(!ssdv_tiles.size()) // delete image when done if(!ssdv_tiles.size()) // delete image when done
system( (string("rm -f ") + G.cli.ssdv_image + " || echo \"Can't delete SSDV image.\"").c_str() ); system( (string("rm -f ") + G.cli.ssdv_image + " || echo \"Can't delete SSDV image.\"").c_str() );

Wyświetl plik

@ -1,6 +1,7 @@
#include "ssdv_t.h" #include "ssdv_t.h"
#include <iostream> #include <iostream>
#include <cstring>
size_t ssdv_t::load_file(const std::string file_path) size_t ssdv_t::load_file(const std::string file_path)
{ {
@ -9,10 +10,11 @@ size_t ssdv_t::load_file(const std::string file_path)
return 0; return 0;
tile_t tile; tile_t tile;
memset(tile.data(), 0x00, sizeof(tile));
size_t total_tiles = 0; size_t total_tiles = 0;
while(1) while(1)
{ {
const size_t read_bytes = fread( tile.data(), sizeof(char), 256, p_file ); const size_t read_bytes = fread( tile.data(), 1, sizeof(tile), p_file );
if(!read_bytes) if(!read_bytes)
return total_tiles; return total_tiles;
tiles_que_.push_back(tile); tiles_que_.push_back(tile);

Wyświetl plik

@ -10,7 +10,7 @@ class ssdv_t
public: public:
using tile_t = std::array<char, 256>; using tile_t = std::array<char, 256>;
bool size() const { return tiles_que_.size(); } size_t size() const { return tiles_que_.size(); }
size_t load_file(const std::string file_path); size_t load_file(const std::string file_path);
tile_t next_tile(); // pop tile from que and return tile_t next_tile(); // pop tile from que and return