kopia lustrzana https://github.com/DL7AD/pecanpico9
Fixed radio kept swiched on
When a picture was sent, the radio was kept switched on. The detection of the image EOI did not work for the packet transmission because the EOI detection returned the method earlier.Develop
rodzic
b5d7bed0ff
commit
70ff480b43
|
@ -1178,8 +1178,8 @@ bool OV5640_Capture(void)
|
|||
nvicEnableVector(EXTI1_IRQn, 1); // Enable interrupt
|
||||
|
||||
do { // Have a look for some bytes in memory for testing if capturing works
|
||||
TRACE_INFO("CAM > Capturing");
|
||||
chThdSleepMilliseconds(100);
|
||||
TRACE_INFO("CAM > ... capturing");
|
||||
chThdSleepMilliseconds(200);
|
||||
} while(!capture_finished && !dma_error);
|
||||
|
||||
if (dma_error) {
|
||||
|
|
|
@ -29,7 +29,7 @@ bool initialized = false;
|
|||
*/
|
||||
void Si4464_Init(void) {
|
||||
// Reset radio)
|
||||
radioShutdown();
|
||||
Si4464_shutdown();
|
||||
chThdSleepMilliseconds(10);
|
||||
|
||||
// Initialize SPI
|
||||
|
@ -295,7 +295,7 @@ void stopTx(void) {
|
|||
Si4464_write(change_state_command, 2);
|
||||
}
|
||||
|
||||
void radioShutdown(void) {
|
||||
void Si4464_shutdown(void) {
|
||||
palSetLine(LINE_RADIO_SDN); // Power down chip
|
||||
palSetLine(LINE_IO_LED1); // Set indication LED
|
||||
RADIO_MOD_GPIO(false); // Set GPIO1 low
|
||||
|
|
|
@ -21,7 +21,7 @@ void setDeviation(uint32_t deviation);
|
|||
void setPowerLevel(int8_t level);
|
||||
void startTx(uint16_t size);
|
||||
void stopTx(void);
|
||||
void radioShutdown(void);
|
||||
void Si4464_shutdown(void);
|
||||
bool radioTune(uint32_t frequency, uint16_t shift, int8_t level, uint16_t size);
|
||||
void Si4464_writeFIFO(uint8_t *msg, uint8_t size);
|
||||
uint8_t Si4464_freeFIFO(void);
|
||||
|
|
|
@ -54,9 +54,11 @@ void encode_ssdv(uint8_t *image, uint32_t image_len, module_conf_t* conf, uint8_
|
|||
|
||||
if(c == SSDV_EOI)
|
||||
{
|
||||
shutdownRadio();
|
||||
TRACE_INFO("SSDV > ssdv_enc_get_packet said EOI");
|
||||
break;
|
||||
} else if(c != SSDV_OK) {
|
||||
shutdownRadio();
|
||||
TRACE_ERROR("SSDV > ssdv_enc_get_packet failed: %i", c);
|
||||
return;
|
||||
}
|
||||
|
@ -82,7 +84,7 @@ void encode_ssdv(uint8_t *image, uint32_t image_len, module_conf_t* conf, uint8_
|
|||
|
||||
// Transmit on radio (keep transmitter switched on if packet spacing=0ms and it isnt the last packet being sent)
|
||||
if(redudantTx) transmitOnRadio(&msg, false); // Redundant transmission
|
||||
transmitOnRadio(&msg, conf->packet_spacing != 0 || c == SSDV_EOI || c != SSDV_OK);
|
||||
transmitOnRadio(&msg, conf->packet_spacing != 0); // Keep transmitter switched on if next packet will be sent right away
|
||||
break;
|
||||
|
||||
case PROT_SSDV_2FSK:
|
||||
|
@ -93,7 +95,7 @@ void encode_ssdv(uint8_t *image, uint32_t image_len, module_conf_t* conf, uint8_
|
|||
msg.bin_len = 8*sizeof(pkt);
|
||||
|
||||
if(redudantTx) transmitOnRadio(&msg, false); // Redundant transmission
|
||||
transmitOnRadio(&msg, conf->packet_spacing != 0 || c == SSDV_EOI || c != SSDV_OK);
|
||||
transmitOnRadio(&msg, conf->packet_spacing != 0); // Keep transmitter switched on if next packet will be sent right away
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -260,6 +260,12 @@ void send2FSK(radioMSG_t *msg) {
|
|||
chThdSleepMilliseconds(1); // Wait for routine to finish
|
||||
}
|
||||
|
||||
void shutdownRadio(void)
|
||||
{
|
||||
Si4464_shutdown();
|
||||
active_mod = MOD_NOT_SET;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns APRS region specific frequency determined by GPS location. It will
|
||||
* use the APRS default frequency set in the config file if no GPS fix has
|
||||
|
@ -354,8 +360,7 @@ bool transmitOnRadio(radioMSG_t *msg, bool shutdown) {
|
|||
|
||||
if(shutdown)
|
||||
{
|
||||
radioShutdown(); // Shutdown radio for reinitialization
|
||||
active_mod = MOD_NOT_SET;
|
||||
shutdownRadio(); // Shutdown radio for reinitialization
|
||||
} else {
|
||||
active_mod = msg->mod;
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
extern mutex_t radio_mtx;
|
||||
|
||||
bool transmitOnRadio(radioMSG_t *msg, bool shutdown);
|
||||
void shutdownRadio(void);
|
||||
uint32_t getFrequency(freq_conf_t *config);
|
||||
|
||||
THD_FUNCTION(moduleRADIO, arg);
|
||||
|
|
Ładowanie…
Reference in New Issue