Make AFSKTestTone object globally accessible. Stop sending test tones if a real packet arrives. Fix broken header guard.

fsk9600
Rob Riggs 2019-01-05 20:48:57 -06:00
rodzic 2790d1aa1a
commit a0aba01af3
4 zmienionych plików z 17 dodań i 10 usunięć

Wyświetl plik

@ -2,7 +2,7 @@
// All rights reserved.
#ifndef MOBILINKD__TNC__AFSK_TEST_TONE_HPP_
#define MOBILINKD__TNC__AFSKTESTTONE_HPP_
#define MOBILINKD__TNC__AFSK_TEST_TONE_HPP_
#include "cmsis_os.h"
@ -29,4 +29,4 @@ struct AFSKTestTone
}} // mobilinkd::tnc
#endif // MOBILINKD__TNC__AFSKTESTTONE_HPP_
#endif // MOBILINKD__TNC__AFSK_TEST_TONE_HPP_

Wyświetl plik

@ -308,6 +308,7 @@ void startIOEventTask(void const*)
DEBUG("Serial frame");
if ((frame->type() & 0x0F) == IoFrame::DATA)
{
kiss::getAFSKTestTone().stop();
if (osMessagePut(hdlcOutputQueueHandle,
reinterpret_cast<uint32_t>(frame),
osWaitForever) != osOK)

Wyświetl plik

@ -5,7 +5,6 @@
#include "PortInterface.hpp"
#include "AudioInput.hpp"
#include "AudioLevel.hpp"
#include "AFSKTestTone.hpp"
#include "IOEventTask.h"
#include <ModulatorTask.hpp>
@ -153,9 +152,13 @@ void Hardware::announce_input_settings()
reply16(hardware::GET_INPUT_GAIN, input_gain);
reply8(hardware::GET_INPUT_TWIST, rx_twist);
}
void Hardware::handle_request(hdlc::IoFrame* frame) {
static AFSKTestTone testTone;
AFSKTestTone& getAFSKTestTone() {
static AFSKTestTone testTone;
return testTone;
}
void Hardware::handle_request(hdlc::IoFrame* frame) {
auto it = frame->begin();
uint8_t command = *it++;
@ -169,7 +172,7 @@ void Hardware::handle_request(hdlc::IoFrame* frame) {
case hardware::SET_OUTPUT_TWIST:
break;
default:
testTone.stop();
getAFSKTestTone().stop();
}
switch (command) {
@ -206,23 +209,23 @@ void Hardware::handle_request(hdlc::IoFrame* frame) {
DEBUG("SEND_MARK");
osMessagePut(audioInputQueueHandle, audio::IDLE,
osWaitForever);
testTone.mark();
getAFSKTestTone().mark();
break;
case hardware::SEND_SPACE:
DEBUG("SEND_SPACE");
osMessagePut(audioInputQueueHandle, audio::IDLE,
osWaitForever);
testTone.space();
getAFSKTestTone().space();
break;
case hardware::SEND_BOTH:
DEBUG("SEND_BOTH");
osMessagePut(audioInputQueueHandle, audio::IDLE,
osWaitForever);
testTone.both();
getAFSKTestTone().both();
break;
case hardware::STOP_TX:
DEBUG("STOP_TX");
testTone.stop();
getAFSKTestTone().stop();
osMessagePut(audioInputQueueHandle, audio::IDLE,
osWaitForever);
break;

Wyświetl plik

@ -7,6 +7,7 @@
#include "KissHardware.h"
#include "Log.h"
#include "HdlcFrame.hpp"
#include "AFSKTestTone.hpp"
#include <cstdint>
#include <cstring>
@ -19,6 +20,8 @@ namespace mobilinkd { namespace tnc { namespace kiss {
extern const char FIRMWARE_VERSION[];
extern const char HARDWARE_VERSION[];
AFSKTestTone& getAFSKTestTone();
namespace hardware {
/**