[SSTV] Use compact Doxygen and stop using reserved format
This commit is contained in:
parent
7a99aa0ef4
commit
47e759f322
2 changed files with 43 additions and 53 deletions
|
@ -155,22 +155,22 @@ const SSTVMode_t PasokonP7 {
|
||||||
};
|
};
|
||||||
|
|
||||||
SSTVClient::SSTVClient(PhysicalLayer* phy) {
|
SSTVClient::SSTVClient(PhysicalLayer* phy) {
|
||||||
_phy = phy;
|
phyLayer = phy;
|
||||||
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
||||||
_audio = nullptr;
|
audioClient = nullptr;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
||||||
SSTVClient::SSTVClient(AFSKClient* audio) {
|
SSTVClient::SSTVClient(AFSKClient* audio) {
|
||||||
_phy = audio->_phy;
|
phyLayer = audio->phyLayer;
|
||||||
_audio = audio;
|
audioClient = audio;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
||||||
int16_t SSTVClient::begin(const SSTVMode_t& mode) {
|
int16_t SSTVClient::begin(const SSTVMode_t& mode) {
|
||||||
if(_audio == nullptr) {
|
if(audioClient == nullptr) {
|
||||||
// this initialization method can only be used in AFSK mode
|
// this initialization method can only be used in AFSK mode
|
||||||
return(RADIOLIB_ERR_WRONG_MODEM);
|
return(RADIOLIB_ERR_WRONG_MODEM);
|
||||||
}
|
}
|
||||||
|
@ -181,38 +181,38 @@ int16_t SSTVClient::begin(const SSTVMode_t& mode) {
|
||||||
|
|
||||||
int16_t SSTVClient::begin(float base, const SSTVMode_t& mode) {
|
int16_t SSTVClient::begin(float base, const SSTVMode_t& mode) {
|
||||||
// save mode
|
// save mode
|
||||||
_mode = mode;
|
txMode = mode;
|
||||||
|
|
||||||
// calculate 24-bit frequency
|
// calculate 24-bit frequency
|
||||||
_base = (base * 1000000.0) / _phy->getFreqStep();
|
baseFreq = (base * 1000000.0) / phyLayer->getFreqStep();
|
||||||
|
|
||||||
// configure for direct mode
|
// configure for direct mode
|
||||||
return(_phy->startDirect());
|
return(phyLayer->startDirect());
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t SSTVClient::setCorrection(float correction) {
|
int16_t SSTVClient::setCorrection(float correction) {
|
||||||
// check if mode is initialized
|
// check if mode is initialized
|
||||||
if(_mode.visCode == 0) {
|
if(txMode.visCode == 0) {
|
||||||
return(RADIOLIB_ERR_WRONG_MODEM);
|
return(RADIOLIB_ERR_WRONG_MODEM);
|
||||||
}
|
}
|
||||||
|
|
||||||
// apply correction factor to all timings
|
// apply correction factor to all timings
|
||||||
_mode.scanPixelLen *= correction;
|
txMode.scanPixelLen *= correction;
|
||||||
for(uint8_t i = 0; i < _mode.numTones; i++) {
|
for(uint8_t i = 0; i < txMode.numTones; i++) {
|
||||||
_mode.tones[i].len *= correction;
|
txMode.tones[i].len *= correction;
|
||||||
}
|
}
|
||||||
return(RADIOLIB_ERR_NONE);
|
return(RADIOLIB_ERR_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SSTVClient::idle() {
|
void SSTVClient::idle() {
|
||||||
_phy->transmitDirect();
|
phyLayer->transmitDirect();
|
||||||
this->tone(RADIOLIB_SSTV_TONE_LEADER);
|
this->tone(RADIOLIB_SSTV_TONE_LEADER);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SSTVClient::sendHeader() {
|
void SSTVClient::sendHeader() {
|
||||||
// save first header flag for Scottie modes
|
// save first header flag for Scottie modes
|
||||||
_firstLine = true;
|
firstLine = true;
|
||||||
_phy->transmitDirect();
|
phyLayer->transmitDirect();
|
||||||
|
|
||||||
// send the first part of header (leader-break-leader)
|
// send the first part of header (leader-break-leader)
|
||||||
this->tone(RADIOLIB_SSTV_TONE_LEADER, RADIOLIB_SSTV_HEADER_LEADER_LENGTH);
|
this->tone(RADIOLIB_SSTV_TONE_LEADER, RADIOLIB_SSTV_HEADER_LEADER_LENGTH);
|
||||||
|
@ -225,7 +225,7 @@ void SSTVClient::sendHeader() {
|
||||||
// VIS code
|
// VIS code
|
||||||
uint8_t parityCount = 0;
|
uint8_t parityCount = 0;
|
||||||
for(uint8_t mask = 0x01; mask < 0x80; mask <<= 1) {
|
for(uint8_t mask = 0x01; mask < 0x80; mask <<= 1) {
|
||||||
if(_mode.visCode & mask) {
|
if(txMode.visCode & mask) {
|
||||||
this->tone(RADIOLIB_SSTV_TONE_VIS_1, RADIOLIB_SSTV_HEADER_BIT_LENGTH);
|
this->tone(RADIOLIB_SSTV_TONE_VIS_1, RADIOLIB_SSTV_HEADER_BIT_LENGTH);
|
||||||
parityCount++;
|
parityCount++;
|
||||||
} else {
|
} else {
|
||||||
|
@ -248,23 +248,23 @@ void SSTVClient::sendHeader() {
|
||||||
|
|
||||||
void SSTVClient::sendLine(uint32_t* imgLine) {
|
void SSTVClient::sendLine(uint32_t* imgLine) {
|
||||||
// check first line flag in Scottie modes
|
// check first line flag in Scottie modes
|
||||||
if(_firstLine && ((_mode.visCode == RADIOLIB_SSTV_SCOTTIE_1) || (_mode.visCode == RADIOLIB_SSTV_SCOTTIE_2) || (_mode.visCode == RADIOLIB_SSTV_SCOTTIE_DX))) {
|
if(firstLine && ((txMode.visCode == RADIOLIB_SSTV_SCOTTIE_1) || (txMode.visCode == RADIOLIB_SSTV_SCOTTIE_2) || (txMode.visCode == RADIOLIB_SSTV_SCOTTIE_DX))) {
|
||||||
_firstLine = false;
|
firstLine = false;
|
||||||
|
|
||||||
// send start sync tone
|
// send start sync tone
|
||||||
this->tone(RADIOLIB_SSTV_TONE_BREAK, 9000);
|
this->tone(RADIOLIB_SSTV_TONE_BREAK, 9000);
|
||||||
}
|
}
|
||||||
|
|
||||||
// send all tones in sequence
|
// send all tones in sequence
|
||||||
for(uint8_t i = 0; i < _mode.numTones; i++) {
|
for(uint8_t i = 0; i < txMode.numTones; i++) {
|
||||||
if((_mode.tones[i].type == tone_t::GENERIC) && (_mode.tones[i].len > 0)) {
|
if((txMode.tones[i].type == tone_t::GENERIC) && (txMode.tones[i].len > 0)) {
|
||||||
// sync/porch tones
|
// sync/porch tones
|
||||||
this->tone(_mode.tones[i].freq, _mode.tones[i].len);
|
this->tone(txMode.tones[i].freq, txMode.tones[i].len);
|
||||||
} else {
|
} else {
|
||||||
// scan lines
|
// scan lines
|
||||||
for(uint16_t j = 0; j < _mode.width; j++) {
|
for(uint16_t j = 0; j < txMode.width; j++) {
|
||||||
uint32_t color = imgLine[j];
|
uint32_t color = imgLine[j];
|
||||||
switch(_mode.tones[i].type) {
|
switch(txMode.tones[i].type) {
|
||||||
case(tone_t::SCAN_RED):
|
case(tone_t::SCAN_RED):
|
||||||
color &= 0x00FF0000;
|
color &= 0x00FF0000;
|
||||||
color >>= 16;
|
color >>= 16;
|
||||||
|
@ -279,27 +279,27 @@ void SSTVClient::sendLine(uint32_t* imgLine) {
|
||||||
case(tone_t::GENERIC):
|
case(tone_t::GENERIC):
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
this->tone(RADIOLIB_SSTV_TONE_BRIGHTNESS_MIN + ((float)color * 3.1372549), _mode.scanPixelLen);
|
this->tone(RADIOLIB_SSTV_TONE_BRIGHTNESS_MIN + ((float)color * 3.1372549), txMode.scanPixelLen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t SSTVClient::getPictureHeight() const {
|
uint16_t SSTVClient::getPictureHeight() const {
|
||||||
return(_mode.height);
|
return(txMode.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SSTVClient::tone(float freq, uint32_t len) {
|
void SSTVClient::tone(float freq, uint32_t len) {
|
||||||
Module* mod = _phy->getMod();
|
Module* mod = phyLayer->getMod();
|
||||||
uint32_t start = mod->hal->micros();
|
uint32_t start = mod->hal->micros();
|
||||||
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
||||||
if(_audio != nullptr) {
|
if(audioClient != nullptr) {
|
||||||
_audio->tone(freq, false);
|
audioClient->tone(freq, false);
|
||||||
} else {
|
} else {
|
||||||
_phy->transmitDirect(_base + (freq / _phy->getFreqStep()));
|
phyLayer->transmitDirect(baseFreq + (freq / phyLayer->getFreqStep()));
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
_phy->transmitDirect(_base + (freq / _phy->getFreqStep()));
|
phyLayer->transmitDirect(baseFreq + (freq / phyLayer->getFreqStep()));
|
||||||
#endif
|
#endif
|
||||||
mod->waitForMicroseconds(start, len);
|
mod->waitForMicroseconds(start, len);
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,6 @@
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\struct tone_t
|
\struct tone_t
|
||||||
|
|
||||||
\brief Structure to save data about tone.
|
\brief Structure to save data about tone.
|
||||||
*/
|
*/
|
||||||
struct tone_t {
|
struct tone_t {
|
||||||
|
@ -65,7 +64,6 @@ struct tone_t {
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\struct SSTVMode_t
|
\struct SSTVMode_t
|
||||||
|
|
||||||
\brief Structure to save data about supported SSTV modes.
|
\brief Structure to save data about supported SSTV modes.
|
||||||
*/
|
*/
|
||||||
struct SSTVMode_t {
|
struct SSTVMode_t {
|
||||||
|
@ -114,14 +112,12 @@ extern const SSTVMode_t PasokonP7;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class SSTVClient
|
\class SSTVClient
|
||||||
|
|
||||||
\brief Client for SSTV transmissions.
|
\brief Client for SSTV transmissions.
|
||||||
*/
|
*/
|
||||||
class SSTVClient {
|
class SSTVClient {
|
||||||
public:
|
public:
|
||||||
/*!
|
/*!
|
||||||
\brief Constructor for 2-FSK mode.
|
\brief Constructor for 2-FSK mode.
|
||||||
|
|
||||||
\param phy Pointer to the wireless module providing PhysicalLayer communication.
|
\param phy Pointer to the wireless module providing PhysicalLayer communication.
|
||||||
*/
|
*/
|
||||||
explicit SSTVClient(PhysicalLayer* phy);
|
explicit SSTVClient(PhysicalLayer* phy);
|
||||||
|
@ -129,7 +125,6 @@ class SSTVClient {
|
||||||
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
||||||
/*!
|
/*!
|
||||||
\brief Constructor for AFSK mode.
|
\brief Constructor for AFSK mode.
|
||||||
|
|
||||||
\param audio Pointer to the AFSK instance providing audio.
|
\param audio Pointer to the AFSK instance providing audio.
|
||||||
*/
|
*/
|
||||||
explicit SSTVClient(AFSKClient* audio);
|
explicit SSTVClient(AFSKClient* audio);
|
||||||
|
@ -139,11 +134,9 @@ class SSTVClient {
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Initialization method for 2-FSK.
|
\brief Initialization method for 2-FSK.
|
||||||
|
|
||||||
\param base Base "0 Hz tone" RF frequency to be used in MHz.
|
\param base Base "0 Hz tone" RF frequency to be used in MHz.
|
||||||
|
\param mode SSTV mode to be used. Currently supported modes are Scottie1, Scottie2,
|
||||||
\param mode SSTV mode to be used. Currently supported modes are Scottie1, Scottie2, ScottieDX, Martin1, Martin2, Wrasse, PasokonP3, PasokonP5 and PasokonP7.
|
ScottieDX, Martin1, Martin2, Wrasse, PasokonP3, PasokonP5 and PasokonP7.
|
||||||
|
|
||||||
\returns \ref status_codes
|
\returns \ref status_codes
|
||||||
*/
|
*/
|
||||||
int16_t begin(float base, const SSTVMode_t& mode);
|
int16_t begin(float base, const SSTVMode_t& mode);
|
||||||
|
@ -151,9 +144,8 @@ class SSTVClient {
|
||||||
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
||||||
/*!
|
/*!
|
||||||
\brief Initialization method for AFSK.
|
\brief Initialization method for AFSK.
|
||||||
|
\param mode SSTV mode to be used. Currently supported modes are Scottie1, Scottie2,
|
||||||
\param mode SSTV mode to be used. Currently supported modes are Scottie1, Scottie2, ScottieDX, Martin1, Martin2, Wrasse, PasokonP3, PasokonP5 and PasokonP7.
|
ScottieDX, Martin1, Martin2, Wrasse, PasokonP3, PasokonP5 and PasokonP7.
|
||||||
|
|
||||||
\returns \ref status_codes
|
\returns \ref status_codes
|
||||||
*/
|
*/
|
||||||
int16_t begin(const SSTVMode_t& mode);
|
int16_t begin(const SSTVMode_t& mode);
|
||||||
|
@ -161,9 +153,8 @@ class SSTVClient {
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Set correction coefficient for tone length.
|
\brief Set correction coefficient for tone length.
|
||||||
|
\param correction Timing correction factor, used to adjust the length of timing pulses.
|
||||||
\param correction Timing correction factor, used to adjust the length of timing pulses. Less than 1.0 leads to shorter timing pulses, defaults to 1.0 (no correction).
|
Less than 1.0 leads to shorter timing pulses, defaults to 1.0 (no correction).
|
||||||
|
|
||||||
\returns \ref status_codes
|
\returns \ref status_codes
|
||||||
*/
|
*/
|
||||||
int16_t setCorrection(float correction);
|
int16_t setCorrection(float correction);
|
||||||
|
@ -180,14 +171,13 @@ class SSTVClient {
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Sends single picture line in the currently configured SSTV mode.
|
\brief Sends single picture line in the currently configured SSTV mode.
|
||||||
|
\param imgLine Image line to send, in 24-bit RGB. It is up to the user to ensure that
|
||||||
\param imgLine Image line to send, in 24-bit RGB. It is up to the user to ensure that imgLine has enough pixels to send it in the current SSTV mode.
|
imgLine has enough pixels to send it in the current SSTV mode.
|
||||||
*/
|
*/
|
||||||
void sendLine(uint32_t* imgLine);
|
void sendLine(uint32_t* imgLine);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Get picture height of the currently configured SSTV mode.
|
\brief Get picture height of the currently configured SSTV mode.
|
||||||
|
|
||||||
\returns Picture height of the currently configured SSTV mode in pixels.
|
\returns Picture height of the currently configured SSTV mode in pixels.
|
||||||
*/
|
*/
|
||||||
uint16_t getPictureHeight() const;
|
uint16_t getPictureHeight() const;
|
||||||
|
@ -195,14 +185,14 @@ class SSTVClient {
|
||||||
#if !defined(RADIOLIB_GODMODE)
|
#if !defined(RADIOLIB_GODMODE)
|
||||||
private:
|
private:
|
||||||
#endif
|
#endif
|
||||||
PhysicalLayer* _phy;
|
PhysicalLayer* phyLayer;
|
||||||
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
||||||
AFSKClient* _audio;
|
AFSKClient* audioClient;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint32_t _base = 0;
|
uint32_t baseFreq = 0;
|
||||||
SSTVMode_t _mode = Scottie1;
|
SSTVMode_t txMode = Scottie1;
|
||||||
bool _firstLine = true;
|
bool firstLine = true;
|
||||||
|
|
||||||
void tone(float freq, uint32_t len = 0);
|
void tone(float freq, uint32_t len = 0);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue