kopia lustrzana https://github.com/jamescoxon/dl-fldigi
Merge pull request #4 from richardeoin/ssdv_cbec2
[ssdv-cbec] basic changes to allow ssdv-cbec packets (0x68)master
commit
b57fd5bd21
|
@ -118,6 +118,7 @@ typedef struct
|
||||||
} ssdv_t;
|
} ssdv_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
uint8_t type;
|
||||||
uint32_t callsign;
|
uint32_t callsign;
|
||||||
uint8_t image_id;
|
uint8_t image_id;
|
||||||
uint16_t packet_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 */
|
/* Testing is destructive, work on a copy */
|
||||||
memcpy(pkt, packet, SSDV_PKT_SIZE);
|
memcpy(pkt, packet, SSDV_PKT_SIZE);
|
||||||
pkt[0] = 0x55;
|
pkt[0] = 0x55;
|
||||||
pkt[1] = 0x66;
|
|
||||||
|
|
||||||
/* Find the erasure positions */
|
/* Find the erasure positions */
|
||||||
no_eras = 0;
|
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(i < 0) return(-1); /* Reed-solomon decoder failed */
|
||||||
if(errors) *errors = i;
|
if(errors) *errors = i;
|
||||||
|
|
||||||
/* Sanity checks */
|
/* Sanity checks. 0x66 = JPG FEC, 0x68 = CBEC FEC */
|
||||||
if(pkt[1] != 0x66) return(-1);
|
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);
|
ssdv_dec_header(&p, pkt);
|
||||||
if(p.width == 0 || p.height == 0) return(-1);
|
if(p.width == 0 || p.height == 0) return(-1);
|
||||||
if(p.mcu_id != 0xFFFF)
|
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)
|
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->callsign = (packet[2] << 24) | (packet[3] << 16) | (packet[4] << 8) | packet[5];
|
||||||
info->image_id = packet[6];
|
info->image_id = packet[6];
|
||||||
info->packet_id = (packet[7] << 8) | packet[8];
|
info->packet_id = (packet[7] << 8) | packet[8];
|
||||||
|
|
|
@ -413,6 +413,32 @@ void ssdv_rx::put_byte(uint8_t byte, int lost)
|
||||||
/* Read the header */
|
/* Read the header */
|
||||||
ssdv_dec_header(&pkt_info, b);
|
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? */
|
/* Does this belong to the same image? */
|
||||||
if(pkt_info.callsign != image_callsign ||
|
if(pkt_info.callsign != image_callsign ||
|
||||||
pkt_info.image_id != image_id ||
|
pkt_info.image_id != image_id ||
|
||||||
|
@ -479,28 +505,6 @@ void ssdv_rx::put_byte(uint8_t byte, int lost)
|
||||||
/* Done with the receive buffer */
|
/* Done with the receive buffer */
|
||||||
clear_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 */
|
/* Initialise the decoder */
|
||||||
ssdv_t dec;
|
ssdv_t dec;
|
||||||
ssdv_dec_init(&dec);
|
ssdv_dec_init(&dec);
|
||||||
|
|
Ładowanie…
Reference in New Issue