Implemented SSDV USB transmission, updated decoder for SSDV over USB receiption

Develop
Sven Steudte 2017-09-08 00:06:22 +02:00
rodzic 28f4e7620f
commit d9309f3266
5 zmienionych plików z 55 dodań i 44 usunięć

Wyświetl plik

@ -15,8 +15,8 @@ from subprocess import *
from cStringIO import StringIO
send_to_server = False
SCREENX = 640
SCREENY = 480
SCREENX = 1024
SCREENY = 768
pygame.font.init()
myfont = pygame.font.SysFont('Comic Sans MS', 20)
textsurface = myfont.render('Callsign: DL7AD2 Image ID: 07 Resolution: 640x480', False, (0, 255, 255))
@ -81,12 +81,19 @@ def received_data(data):
# Parse line and detect data
m = re.search("(.*)\>APECAN(.*):\{\{I(.*)", data)
try:
call = m.group(1)
aprs = m.group(3)
receiver = 'bla'
except:
return # message format incorrect (probably no APRS message or line cut off too short)
if m:
try:
call = m.group(1)
aprs = m.group(3)
receiver = 'bla'
except:
return # message format incorrect (probably no APRS message or line cut off too short)
else:
m = re.search("\[(.*)\]\[(.*)\] DATA \> (.*)", data)
try:
aprs = m.group(3)
except:
return
if args.log is not None:
logfile.write(data) # Log data to file
@ -100,24 +107,6 @@ def received_data(data):
if len(data) != 219:
return # APRS message sampled too short
jsons.append("""{
\"type\": \"packet\",
\"packet\": \"""" + ssdv + """\",
\"encoding\": \"hex\",
\"received\": \"""" + datetime.datetime.now().isoformat('T')[:19] + """Z\",
\"receiver\": \"""" + receiver + """\"
}""")
#print datetime.datetime.now().isoformat('T') + ' Received packet call %02x%02x%02x%02x image %d packet %d' % (data[1], data[2], data[3], data[4], data[5], data[7] + data[6] * 256)
# Write data buffer to file
#open file with name from datetime and image count
#fa = open(filename_str_ssdv,'ab+', 0) # buffer 0 flush data just an time
#fa.write(binascii.unhexlify(ssdv))
#fa.close()
# call only if file exist with minimum 2 packet
#os.system("./ssdv -d -c %s ./%s ./currximg.jpg" % (args.call, filename_str_ssdv))
if (data[7] + data[6] * 256) == 0:
buf = ''
@ -186,4 +175,4 @@ else:
pygame.display.flip()
pygame.display.update(displaygroup.draw(screen))
clock.tick(30)
clock.tick(500)

Wyświetl plik

@ -451,7 +451,7 @@ void start_user_modules(void)
// Module IMAGE, APRS 2m 2GFSK
config[4].power = 127; // Transmission Power
config[4].protocol = PROT_APRS_2GFSK; // Protocol APRS/SSDV (2GFSK)
config[4].gfsk_conf.speed = 19200; // 2GFSK Speed
config[4].gfsk_conf.speed = 9600; // 2GFSK Speed
config[4].frequency.type = FREQ_STATIC; // Static frequency allocation
config[4].frequency.hz = 144860000; // Transmission frequency 144.860 MHz
config[4].trigger.type = TRIG_CONTINUOUSLY; // Transmit continuously
@ -483,23 +483,32 @@ void start_user_modules(void)
config[5].ssdv_conf.quality = 4; // Image quality
//start_image_thread(&config[5]);
// Module IMAGE, USB
config[6].protocol = PROT_SSDV_USB; // Protocol SSDV transmission over USB
config[6].trigger.type = TRIG_CONTINUOUSLY; // Transmit continuously
chsnprintf(config[6].ssdv_conf.callsign, 7, "DL7AD2"); // SSDV Callsign
config[6].ssdv_conf.ram_buffer = ssdv_buffer; // Camera buffer
config[6].ssdv_conf.ram_size = sizeof(ssdv_buffer); // Buffer size
config[6].ssdv_conf.res = RES_XGA; // Resolution XGA
config[6].ssdv_conf.quality = 4; // Image quality
start_image_thread(&config[6]);
/* ----------------------------------------------------- LOG TRANSMISSION ---------------------------------------------------- */
// Module LOG, APRS 2m AFSK
config[6].power = 127; // Transmission Power
config[6].protocol = PROT_APRS_AFSK; // Protocol APRS (AFSK)
config[6].frequency.type = FREQ_APRS_REGION; // Dynamic frequency allocation
config[6].frequency.hz = 144800000; // Default frequency 144.800 MHz
config[6].init_delay = 60000; // Module startup delay (60 seconds)
config[6].trigger.type = TRIG_TIMEOUT; // Periodic cycling (every 180 seconds)
config[6].trigger.timeout = 180; // Timeout 180 sec
chsnprintf(config[6].aprs_conf.callsign, 16, "DL7AD"); // APRS Callsign
config[6].aprs_conf.ssid = 12; // APRS SSID
chsnprintf(config[6].aprs_conf.path, 16, "WIDE1-1"); // APRS Path
config[6].aprs_conf.preamble = 300; // APRS Preamble (300ms)
//start_logging_thread(&config[6]);
config[7].power = 127; // Transmission Power
config[7].protocol = PROT_APRS_AFSK; // Protocol APRS (AFSK)
config[7].frequency.type = FREQ_APRS_REGION; // Dynamic frequency allocation
config[7].frequency.hz = 144800000; // Default frequency 144.800 MHz
config[7].init_delay = 60000; // Module startup delay (60 seconds)
config[7].trigger.type = TRIG_TIMEOUT; // Periodic cycling (every 180 seconds)
config[7].trigger.timeout = 180; // Timeout 180 sec
chsnprintf(config[7].aprs_conf.callsign, 16, "DL7AD"); // APRS Callsign
config[7].aprs_conf.ssid = 12; // APRS SSID
chsnprintf(config[7].aprs_conf.path, 16, "WIDE1-1"); // APRS Path
config[7].aprs_conf.preamble = 300; // APRS Preamble (300ms)
//start_logging_thread(&config[7]);
}

Wyświetl plik

@ -42,6 +42,11 @@ extern bool debug_on_usb;
chprintf((BaseSequentialStream*)&SD3, (format), ##args); \
chprintf((BaseSequentialStream*)&SD3, "\r\n"); \
\
TRACE_BASE_USB(format, type, ##args); \
chMtxUnlock(&trace_mtx); \
}
#define TRACE_BASE_USB(format, type, args...) { \
if(usb_initialized && debug_on_usb) { \
if(TRACE_TIME) { \
chprintf((BaseSequentialStream*)&SDU1, "[%8d.%03d]", chVTGetSystemTimeX()/CH_CFG_ST_FREQUENCY, (chVTGetSystemTimeX()*1000/CH_CFG_ST_FREQUENCY)%1000); \
@ -54,14 +59,13 @@ extern bool debug_on_usb;
chprintf((BaseSequentialStream*)&SDU1, (format), ##args); \
chprintf((BaseSequentialStream*)&SDU1, "\r\n"); \
} \
\
chMtxUnlock(&trace_mtx); \
}
#define TRACE_DEBUG(format, args...) TRACE_BASE(format, "DEBUG", ##args)
#define TRACE_INFO(format, args...) TRACE_BASE(format, " ", ##args)
#define TRACE_WARN(format, args...) TRACE_BASE(format, "WARN ", ##args)
#define TRACE_ERROR(format, args...) TRACE_BASE(format, "ERROR", ##args)
#define TRACE_USB(format, args...) TRACE_BASE_USB(format, "USB ", ##args) /* only traced on USB */
#if TRACE_TIME && TRACE_FILE
#define TRACE_TAB " "

Wyświetl plik

@ -405,6 +405,14 @@ void encode_ssdv(const uint8_t *image, uint32_t image_len, module_conf_t* conf,
}
break;
case PROT_SSDV_USB:
// Encode packet
TRACE_INFO("IMG > Encode 2FSK/SSDV packet");
base91_encode(&pkt[1], pkt_base91, sizeof(pkt)-37); // Sync byte, CRC and FEC of SSDV not transmitted
TRACE_USB("DATA > %s", pkt_base91);
break;
default:
TRACE_ERROR("IMG > Unsupported protocol selected for module IMAGE");
}

Wyświetl plik

@ -1,8 +1,8 @@
#ifndef __TYPES_H__
#define __TYPES_H__
//#define HIGH true
//#define LOW false
#define HIGH true
#define LOW false
typedef enum { // Modulation type
MOD_NOT_SET,
@ -15,6 +15,7 @@ typedef enum { // Modulation type
// Protocol type
typedef enum {
PROT_SSDV_2FSK,
PROT_SSDV_USB,
PROT_APRS_AFSK,
PROT_APRS_2GFSK,
PROT_UKHAS_2FSK,