kopia lustrzana https://github.com/ogre/pizero_tracker
ssdv rename tile to packet
rodzic
0197f1b6f0
commit
c80b426216
|
@ -267,7 +267,7 @@ int main1(int argc, char** argv)
|
||||||
|
|
||||||
// READ SENSORS, CONSTRUCT TELEMETRY MESSAGE, RF SEND TELEMETRY AND IMAGE
|
// READ SENSORS, CONSTRUCT TELEMETRY MESSAGE, RF SEND TELEMETRY AND IMAGE
|
||||||
//
|
//
|
||||||
ssdv_t ssdv_tiles;
|
ssdv_t ssdv_packets;
|
||||||
int msg_id = 0;
|
int msg_id = 0;
|
||||||
while(G_RUN)
|
while(G_RUN)
|
||||||
{
|
{
|
||||||
|
@ -308,18 +308,18 @@ int main1(int argc, char** argv)
|
||||||
// && G.dynamics_get("alt").dVdT_avg() > -5 // not falling
|
// && G.dynamics_get("alt").dVdT_avg() > -5 // not falling
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if( !ssdv_tiles.size() && G.cli.ssdv_image.size() )
|
if( !ssdv_packets.size() && G.cli.ssdv_image.size() )
|
||||||
cout<<"SSDV loaded "<< ssdv_tiles.load_file( G.cli.ssdv_image ) <<" packets from disk."<<endl;
|
cout<<"SSDV loaded "<< ssdv_packets.load_file( G.cli.ssdv_image ) <<" packets from disk."<<endl;
|
||||||
|
|
||||||
if( ssdv_tiles.size() )
|
if( ssdv_packets.size() )
|
||||||
{
|
{
|
||||||
auto tile = ssdv_tiles.next_tile();
|
auto tile = ssdv_packets.next_packet();
|
||||||
cout<<"Send SSDV @RF. Left tiles: "<<ssdv_tiles.size()<<endl;
|
cout<<"Send SSDV @RF. Left tiles: "<<ssdv_packets.size()<<endl;
|
||||||
// for(int i=0; i<256; ++i)
|
// for(int i=0; i<256; ++i)
|
||||||
// cout<<" 0x"<<hex<<(int)(tile[i]);
|
// cout<<" 0x"<<hex<<(int)(tile[i]);
|
||||||
// cout<<dec<<endl;
|
// 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_packets.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() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ size_t ssdv_t::load_file(const std::string file_path)
|
||||||
if(!p_file)
|
if(!p_file)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
tile_t tile;
|
packet_t tile;
|
||||||
memset(tile.data(), 0x00, sizeof(tile));
|
memset(tile.data(), 0x00, sizeof(tile));
|
||||||
size_t total_tiles = 0;
|
size_t total_tiles = 0;
|
||||||
while(1)
|
while(1)
|
||||||
|
@ -22,9 +22,9 @@ size_t ssdv_t::load_file(const std::string file_path)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ssdv_t::tile_t ssdv_t::next_tile()
|
ssdv_t::packet_t ssdv_t::next_packet()
|
||||||
{
|
{
|
||||||
tile_t tile = tiles_que_.front();
|
packet_t tile = tiles_que_.front();
|
||||||
tiles_que_.pop_front();
|
tiles_que_.pop_front();
|
||||||
return tile;
|
return tile;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,12 +9,12 @@ class ssdv_t
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using tile_t = std::array<char, 256>;
|
using packet_t = std::array<char, 256>;
|
||||||
size_t 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
|
packet_t next_packet(); // pop packet from que and return
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::deque<tile_t> tiles_que_;
|
std::deque<packet_t> tiles_que_;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
Ładowanie…
Reference in New Issue