mirror of
https://github.com/peterantypas/maiana.git
synced 2025-06-01 23:30:11 -07:00
sentence
This commit is contained in:
parent
18e14fe4c7
commit
94dd635b3c
@ -48,6 +48,9 @@ public:
|
|||||||
const OTPData *readOTP();
|
const OTPData *readOTP();
|
||||||
bool writeOTP(const OTPData &data);
|
bool writeOTP(const OTPData &data);
|
||||||
void reportSystemData();
|
void reportSystemData();
|
||||||
|
void enableTX();
|
||||||
|
void disableTX();
|
||||||
|
bool isTXEnabled();
|
||||||
private:
|
private:
|
||||||
Configuration();
|
Configuration();
|
||||||
bool erasePage();
|
bool erasePage();
|
||||||
|
@ -26,11 +26,14 @@ public:
|
|||||||
void queueMessage18(VHFChannel channel);
|
void queueMessage18(VHFChannel channel);
|
||||||
void queueMessage24(VHFChannel channel);
|
void queueMessage24(VHFChannel channel);
|
||||||
|
|
||||||
|
void reportTXStatus();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TXScheduler ();
|
TXScheduler ();
|
||||||
virtual ~TXScheduler ();
|
virtual ~TXScheduler ();
|
||||||
time_t positionReportTimeInterval();
|
time_t positionReportTimeInterval();
|
||||||
void sendNMEASentence(const char *sentence);
|
void sendNMEASentence(const char *sentence);
|
||||||
|
bool isTXAllowed();
|
||||||
private:
|
private:
|
||||||
VHFChannel mPositionReportChannel;
|
VHFChannel mPositionReportChannel;
|
||||||
VHFChannel mStaticDataChannel;
|
VHFChannel mStaticDataChannel;
|
||||||
|
@ -151,7 +151,7 @@ void CommandProcessor::processCommand(const char *buff)
|
|||||||
}
|
}
|
||||||
else if ( s.find("tx?") == 0 )
|
else if ( s.find("tx?") == 0 )
|
||||||
{
|
{
|
||||||
// TODO
|
TXScheduler::instance().reportTXStatus();
|
||||||
}
|
}
|
||||||
else if (s.find("reboot") == 0 )
|
else if (s.find("reboot") == 0 )
|
||||||
{
|
{
|
||||||
|
@ -62,12 +62,26 @@ void Configuration::init()
|
|||||||
bool cliBootMode = *(uint32_t*)BOOTMODE_ADDRESS == CLI_FLAG_MAGIC;
|
bool cliBootMode = *(uint32_t*)BOOTMODE_ADDRESS == CLI_FLAG_MAGIC;
|
||||||
if ( !cliBootMode )
|
if ( !cliBootMode )
|
||||||
{
|
{
|
||||||
//reportOTPData();
|
|
||||||
reportSystemData();
|
reportSystemData();
|
||||||
reportStationData();
|
reportStationData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Configuration::enableTX()
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
void Configuration::disableTX()
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Configuration::isTXEnabled()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
const char *Configuration::hwRev()
|
const char *Configuration::hwRev()
|
||||||
{
|
{
|
||||||
const OTPData *otp = readOTP();
|
const OTPData *otp = readOTP();
|
||||||
|
@ -62,12 +62,39 @@ TXScheduler::TXScheduler ()
|
|||||||
|
|
||||||
void TXScheduler::init()
|
void TXScheduler::init()
|
||||||
{
|
{
|
||||||
|
reportTXStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
TXScheduler::~TXScheduler ()
|
TXScheduler::~TXScheduler ()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TXScheduler::reportTXStatus()
|
||||||
|
{
|
||||||
|
bool hwSwitchOff = bsp_is_tx_disabled();
|
||||||
|
bool softSwitch = Configuration::instance().isTXEnabled();
|
||||||
|
bool hasStation = Configuration::instance().isStationDataProvisioned();
|
||||||
|
|
||||||
|
bool status = hwSwitchOff ? false : (softSwitch && hasStation);
|
||||||
|
|
||||||
|
Event *e = EventPool::instance().newEvent(PROPR_NMEA_SENTENCE);
|
||||||
|
if ( !e )
|
||||||
|
return;
|
||||||
|
|
||||||
|
sprintf(e->nmeaBuffer.sentence, "$PAITXCFG,%d,%d,%d,%d*", !hwSwitchOff, softSwitch, hasStation, status);
|
||||||
|
Utils::completeNMEA(e->nmeaBuffer.sentence);
|
||||||
|
EventQueue::instance().push(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TXScheduler::isTXAllowed()
|
||||||
|
{
|
||||||
|
bool hwSwitchOff = bsp_is_tx_disabled();
|
||||||
|
bool softSwitch = Configuration::instance().isTXEnabled();
|
||||||
|
bool hasStation = Configuration::instance().isStationDataProvisioned();
|
||||||
|
|
||||||
|
return hwSwitchOff ? false : (softSwitch && hasStation);
|
||||||
|
}
|
||||||
|
|
||||||
void TXScheduler::processEvent(const Event &e)
|
void TXScheduler::processEvent(const Event &e)
|
||||||
{
|
{
|
||||||
switch(e.type)
|
switch(e.type)
|
||||||
@ -89,7 +116,7 @@ void TXScheduler::processEvent(const Event &e)
|
|||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ( bsp_is_tx_disabled() )
|
if ( !isTXAllowed() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
@ -127,7 +154,10 @@ void TXScheduler::processEvent(const Event &e)
|
|||||||
|
|
||||||
mUTC = e.clock.utc;
|
mUTC = e.clock.utc;
|
||||||
|
|
||||||
//DBG("Clock Event\r\n");
|
// Every minute on the minute ...
|
||||||
|
if ( mUTC % 60 == 0 )
|
||||||
|
reportTXStatus();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user