Added roger beep option in mic TX

This commit is contained in:
furrtek 2017-03-14 08:20:13 +00:00
parent 37cfcd392d
commit 16acb9db28
9 changed files with 83 additions and 26 deletions

View File

@ -629,6 +629,28 @@ static constexpr Bitmap bitmap_icon_previous {
{ 16, 16 }, bitmap_icon_previous_data
};
static constexpr uint8_t bitmap_icon_cwgen_data[] = {
0x00, 0x00,
0x00, 0x00,
0xC0, 0xC0,
0x20, 0x21,
0x20, 0x21,
0x21, 0x21,
0x21, 0x21,
0x21, 0x21,
0x12, 0x12,
0x12, 0x12,
0x12, 0x12,
0x12, 0x12,
0x12, 0x12,
0x0C, 0x0C,
0x00, 0x00,
0x00, 0x00,
};
static constexpr Bitmap bitmap_icon_cwgen {
{ 16, 16 }, bitmap_icon_cwgen_data
};
static constexpr uint8_t bitmap_icon_receivers_data[] = {
0xC0, 0x07,
0x30, 0x18,

View File

@ -29,7 +29,7 @@
//TEST: Imperial in whipcalc
//TODO: Roger beep in mic tx
//TODO: Optimize (and group ?) CTCSS tone gen code
//TODO: Morse use prosigns
//TODO: Morse live keying mode ?
/*

View File

@ -49,7 +49,6 @@ void MicTXView::update_vumeter() {
void MicTXView::on_tx_done() {
// Roger beep transmitted, stop transmitting
transmitting = false;
set_tx(false);
}
@ -89,8 +88,8 @@ void MicTXView::set_tx(bool enable) {
);
gpio_tx.write(0);
led_tx.off();
transmitting = false;
}
transmitting = false;
}
}
@ -126,7 +125,7 @@ void MicTXView::do_timing() {
} else {
// PTT disable :(
const auto switches_state = get_switches_state();
if (!switches_state[1]) // Left button
if (!switches_state[1] && transmitting) // Left button
set_tx(false);
}
}

View File

@ -322,9 +322,9 @@ TransmitterCodedMenuView::TransmitterCodedMenuView(NavigationView& nav) {
TransmitterAudioMenuView::TransmitterAudioMenuView(NavigationView& nav) {
add_items<4>({ {
{ "Soundboard", ui::Color::green(), &bitmap_icon_soundboard, [&nav](){ nav.push<SoundBoardView>(); } },
{ "Numbers station", ui::Color::orange(),&bitmap_icon_numbers, [&nav](){ nav.push<NumbersStationView>(); } },
{ "Numbers station", ui::Color::yellow(),&bitmap_icon_numbers, [&nav](){ nav.push<NumbersStationView>(); } },
{ "Microphone", ui::Color::green(), &bitmap_icon_microphone, [&nav](){ nav.push<MicTXView>(); } },
{ "Whistle", ui::Color::yellow(),&bitmap_icon_whistle, [&nav](){ nav.push<WhistleView>(); } },
{ "Whistle", ui::Color::orange(),&bitmap_icon_whistle, [&nav](){ nav.push<WhistleView>(); } },
} });
on_left = [&nav](){ nav.pop(); };
}
@ -333,11 +333,11 @@ TransmitterAudioMenuView::TransmitterAudioMenuView(NavigationView& nav) {
UtilitiesView::UtilitiesView(NavigationView& nav) {
add_items<5>({ {
{ "Frequency manager", ui::Color::green(), nullptr, [&nav](){ nav.push<FreqManView>(); } },
{ "CW generator", ui::Color::green(), nullptr, [&nav](){ nav.push<CWTXView>(); } },
{ "Whip antenna length", ui::Color::yellow(),nullptr, [&nav](){ nav.push<WhipCalcView>(); } },
{ "Notepad", ui::Color::grey(), nullptr, [&nav](){ nav.push<NotImplementedView>(); } },
{ "Wipe SD card", ui::Color::red(), nullptr, [&nav](){ nav.push<WipeSDView>(); } },
{ "Frequency manager", ui::Color::green(), nullptr, [&nav](){ nav.push<FreqManView>(); } },
{ "CW generator", ui::Color::green(), &bitmap_icon_cwgen, [&nav](){ nav.push<CWTXView>(); } },
{ "Whip antenna length", ui::Color::yellow(),nullptr, [&nav](){ nav.push<WhipCalcView>(); } },
{ "Notepad", ui::Color::grey(), nullptr, [&nav](){ nav.push<NotImplementedView>(); } },
{ "Wipe SD card", ui::Color::red(), nullptr, [&nav](){ nav.push<WipeSDView>(); } },
} });
on_left = [&nav](){ nav.pop(); };
}

View File

@ -21,6 +21,7 @@
*/
#include "proc_mictx.hpp"
#include "tonesets.hpp"
#include "portapack_shared_memory.hpp"
#include "sine_table_int8.hpp"
#include "event_m4.hpp"
@ -37,18 +38,36 @@ void MicTXProcessor::execute(const buffer_c8_t& buffer){
for (size_t i = 0; i<buffer.count; i++) {
sample = audio_buffer.p[i >> 6] >> 8; // 1536000 / 64 = 24000
sample = (sample * (int32_t)gain_x10) / 10;
power += (sample < 0) ? -sample : sample; // Power mean for UI vu-meter
if (!as) {
as = divider;
level_message.value = power / (divider / 4); // Why ?
shared_memory.application_queue.push(level_message);
power = 0;
if (!play_beep) {
sample = audio_buffer.p[i >> 6] >> 8; // 1536000 / 64 = 24000
sample = (sample * (int32_t)gain_x10) / 10;
power += (sample < 0) ? -sample : sample; // Power average for UI vu-meter
if (!as) {
as = divider;
level_message.value = power / (divider / 4); // Why ?
shared_memory.application_queue.push(level_message);
power = 0;
} else {
as--;
}
} else {
as--;
if (beep_timer) {
beep_timer--;
} else {
beep_timer = 76800; // 50ms @ 1536000Hz
if (beep_index == BEEP_TONES_NB) {
configured = false;
fm_delta = 0; // Zero-out the IQ output for the rest of the buffer
shared_memory.application_queue.push(txdone_message);
} else {
beep_phase_inc = beep_deltas[beep_index];
beep_index++;
}
}
sample = sine_table_i8[(beep_phase & 0xFF000000U) >> 24];
beep_phase += beep_phase_inc;
}
if (ctcss_enabled) {
@ -88,14 +107,18 @@ void MicTXProcessor::on_message(const Message* const msg) {
divider = config_message.divider;
ctcss_enabled = config_message.ctcss_enabled;
ctcss_phase_inc = config_message.ctcss_phase_inc;
txdone_message.done = true;
play_beep = false;
configured = true;
break;
case Message::ID::RequestSignal:
if (request_message.signal == RequestSignalMessage::Signal::BeepRequest) {
// TODO
txdone_message.done = true;
beep_index = 0;
beep_timer = 0;
play_beep = true;
}
break;

View File

@ -34,7 +34,7 @@ public:
void on_message(const Message* const msg) override;
private:
bool configured = false;
bool configured { false };
BasebandThread baseband_thread { 1536000, this, NORMALPRIO + 20, baseband::Direction::Transmit };
@ -49,10 +49,12 @@ private:
uint32_t divider { }, gain_x10 { };
uint32_t as { 0 };
uint32_t fm_delta { 0 };
bool play_beep { false };
bool ctcss_enabled { false };
uint32_t ctcss_phase_inc { };
uint32_t ctcss_phase { 0 }, phase { 0 }, sphase { 0 };
int32_t ctcss_sample { 0 }, sample { 0 }, sample_mixed { }, delta { };
uint32_t beep_phase { 0 }, beep_phase_inc { }, beep_index { }, beep_timer { };
uint64_t power { 0 };
int8_t re { 0 }, im { 0 };

View File

@ -23,13 +23,15 @@
#ifndef __TONESETS_H__
#define __TONESETS_H__
#include "portapack.hpp"
#include <memory>
#define TONES_SAMPLERATE 1536000
#define TONES_DELTA_COEF ((1ULL << 32) / TONES_SAMPLERATE)
#define TONES_F2D(f) (uint32_t)(f * TONES_DELTA_COEF)
#define BEEP_TONES_NB 6
#define DTMF_C0 TONES_F2D(1209)
#define DTMF_C1 TONES_F2D(1336)
#define DTMF_C2 TONES_F2D(1477)
@ -116,4 +118,13 @@ const uint32_t zvei_deltas[16] = {
TONES_F2D(680)
};
const uint32_t beep_deltas[BEEP_TONES_NB] = {
TONES_F2D(1475),
TONES_F2D(740),
TONES_F2D(587),
TONES_F2D(1109),
TONES_F2D(831),
TONES_F2D(740)
};
#endif/*__TONESETS_H__*/

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 B

Binary file not shown.