kopia lustrzana https://github.com/jamescoxon/dl-fldigi
[ssdv-cbec] basic changes to allow ssdv-cbec packets (0x68) to be uploaded
rodzic
724782a076
commit
df54d9c56d
|
@ -118,6 +118,7 @@ typedef struct
|
|||
} ssdv_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t type;
|
||||
uint32_t callsign;
|
||||
uint8_t image_id;
|
||||
uint16_t packet_id;
|
||||
|
|
|
@ -1294,7 +1294,6 @@ char ssdv_dec_is_packet(uint8_t *packet, int *errors, uint8_t *erasures)
|
|||
/* Testing is destructive, work on a copy */
|
||||
memcpy(pkt, packet, SSDV_PKT_SIZE);
|
||||
pkt[0] = 0x55;
|
||||
pkt[1] = 0x66;
|
||||
|
||||
/* Find the erasure positions */
|
||||
no_eras = 0;
|
||||
|
@ -1312,9 +1311,17 @@ char ssdv_dec_is_packet(uint8_t *packet, int *errors, uint8_t *erasures)
|
|||
if(i < 0) return(-1); /* Reed-solomon decoder failed */
|
||||
if(errors) *errors = i;
|
||||
|
||||
/* Sanity checks */
|
||||
if(pkt[1] != 0x66) return(-1);
|
||||
|
||||
/* Sanity checks. 0x66 = JPG FEC, 0x68 = CBEC FEC */
|
||||
if((pkt[1] != 0x66) && (pkt[1] != 0x68)) {
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/* Check image properties are sane */
|
||||
/**
|
||||
* This works with both JPG and CBEC types. In CBEC type width
|
||||
* corresponds to sequences, and height corresponds to
|
||||
* blocks. Both must not be zero.
|
||||
*/
|
||||
ssdv_dec_header(&p, pkt);
|
||||
if(p.width == 0 || p.height == 0) return(-1);
|
||||
if(p.mcu_id != 0xFFFF)
|
||||
|
@ -1340,6 +1347,7 @@ char ssdv_dec_is_packet(uint8_t *packet, int *errors, uint8_t *erasures)
|
|||
|
||||
void ssdv_dec_header(ssdv_packet_info_t *info, uint8_t *packet)
|
||||
{
|
||||
info->type = packet[1];
|
||||
info->callsign = (packet[2] << 24) | (packet[3] << 16) | (packet[4] << 8) | packet[5];
|
||||
info->image_id = packet[6];
|
||||
info->packet_id = (packet[7] << 8) | packet[8];
|
||||
|
|
|
@ -412,6 +412,32 @@ void ssdv_rx::put_byte(uint8_t byte, int lost)
|
|||
|
||||
/* Read the header */
|
||||
ssdv_dec_header(&pkt_info, b);
|
||||
|
||||
/* Display a message on the fldigi interface */
|
||||
put_status("SSDV: Decoded image packet!", 10);
|
||||
|
||||
char msg[200], callsign[10];
|
||||
snprintf(msg, 200, "Decoded image packet. Callsign: %s, Image ID: %02X, Resolution: %dx%d, Packet ID: %d",
|
||||
ssdv_decode_callsign(callsign, pkt_info.callsign),
|
||||
pkt_info.image_id,
|
||||
pkt_info.width,
|
||||
pkt_info.height,
|
||||
pkt_info.packet_id);
|
||||
|
||||
if(bHAB)
|
||||
{
|
||||
habString->value(msg);
|
||||
habString->color(FL_GREEN);
|
||||
habString->damage(FL_DAMAGE_ALL);
|
||||
}
|
||||
|
||||
ReceiveText->addstr("\n");
|
||||
ReceiveText->addstr(msg, FTextBase::QSY);
|
||||
ReceiveText->addstr("\n");
|
||||
|
||||
|
||||
/* Only decode JPG type packets */
|
||||
if (pkt_info.type != 0x66) { return; }
|
||||
|
||||
/* Does this belong to the same image? */
|
||||
if(pkt_info.callsign != image_callsign ||
|
||||
|
@ -478,29 +504,7 @@ void ssdv_rx::put_byte(uint8_t byte, int lost)
|
|||
|
||||
/* Done with the receive buffer */
|
||||
clear_buffer();
|
||||
|
||||
/* Display a message on the fldigi interface */
|
||||
put_status("SSDV: Decoded image packet!", 10);
|
||||
|
||||
char msg[200], callsign[10];
|
||||
snprintf(msg, 200, "Decoded image packet. Callsign: %s, Image ID: %02X, Resolution: %dx%d, Packet ID: %d",
|
||||
ssdv_decode_callsign(callsign, pkt_info.callsign),
|
||||
pkt_info.image_id,
|
||||
pkt_info.width,
|
||||
pkt_info.height,
|
||||
pkt_info.packet_id);
|
||||
|
||||
if(bHAB)
|
||||
{
|
||||
habString->value(msg);
|
||||
habString->color(FL_GREEN);
|
||||
habString->damage(FL_DAMAGE_ALL);
|
||||
}
|
||||
|
||||
ReceiveText->addstr("\n");
|
||||
ReceiveText->addstr(msg, FTextBase::QSY);
|
||||
ReceiveText->addstr("\n");
|
||||
|
||||
|
||||
/* Initialise the decoder */
|
||||
ssdv_t dec;
|
||||
ssdv_dec_init(&dec);
|
||||
|
|
Ładowanie…
Reference in New Issue