Added workaround for the CPLD overlay issue in tx mode

Set back mic samplerate to 24kHz because 48kHz was poop :(
This commit is contained in:
furrtek 2017-11-09 22:25:37 +00:00
parent 4465cfb905
commit 32ae059c44
5 changed files with 19 additions and 5 deletions

View File

@ -33,6 +33,7 @@
//BUG: SCANNER Lock on frequency, if frequency jump, still locked on first one //BUG: SCANNER Lock on frequency, if frequency jump, still locked on first one
//BUG: SCANNER Multiple slices //BUG: SCANNER Multiple slices
//TODO: Make tone generator class for baseband (with freq, samplerate and mixing ratio parameters)
//TODO: Cap Wav viewer position //TODO: Cap Wav viewer position
//TODO: Adapt wav viewer position step //TODO: Adapt wav viewer position step
//TODO: Use unit_auto_scale //TODO: Use unit_auto_scale

View File

@ -36,6 +36,8 @@
#include "hackrf_gpio.hpp" #include "hackrf_gpio.hpp"
using namespace hackrf::one; using namespace hackrf::one;
#include "cpld_update.hpp"
#include "portapack.hpp" #include "portapack.hpp"
namespace radio { namespace radio {
@ -105,6 +107,17 @@ void init() {
void set_direction(const rf::Direction new_direction) { void set_direction(const rf::Direction new_direction) {
/* TODO: Refactor all the various "Direction" enumerations into one. */ /* TODO: Refactor all the various "Direction" enumerations into one. */
/* TODO: Only make changes if direction changes, but beware of clock enabling. */ /* TODO: Only make changes if direction changes, but beware of clock enabling. */
if (direction != new_direction) {
if (new_direction == rf::Direction::Transmit) {
hackrf::cpld::init_from_eeprom();
} else {
if( !hackrf::cpld::load_sram() ) {
chSysHalt();
}
}
}
direction = new_direction; direction = new_direction;
second_if.set_mode((direction == rf::Direction::Transmit) ? max2837::Mode::Transmit : max2837::Mode::Receive); second_if.set_mode((direction == rf::Direction::Transmit) ? max2837::Mode::Transmit : max2837::Mode::Receive);

View File

@ -220,7 +220,7 @@ MicTXView::MicTXView(
set_tx(false); set_tx(false);
audio::set_rate(audio::Rate::Hz_48000); audio::set_rate(audio::Rate::Hz_24000);
audio::input::start(); audio::input::start();
} }

View File

@ -74,7 +74,7 @@ private:
bool rogerbeep_enabled { }; bool rogerbeep_enabled { };
uint32_t tone_key_index { }; uint32_t tone_key_index { };
bool tone_key_enabled { }; bool tone_key_enabled { };
uint32_t mic_gain_x10 { }; uint32_t mic_gain_x10 { 10 };
uint32_t audio_level { 0 }; uint32_t audio_level { 0 };
uint32_t va_level { }; uint32_t va_level { };
uint32_t attack_ms { }; uint32_t attack_ms { };

View File

@ -39,7 +39,7 @@ void MicTXProcessor::execute(const buffer_c8_t& buffer){
for (size_t i = 0; i < buffer.count; i++) { for (size_t i = 0; i < buffer.count; i++) {
if (!play_beep) { if (!play_beep) {
sample = audio_buffer.p[i >> 5] >> 8; // 1536000 / 32 = 48000 sample = audio_buffer.p[i >> 6] >> 8; // 1536000 / 64 = 24000
sample = (sample * (int32_t)gain_x10) / 10; sample = (sample * (int32_t)gain_x10) / 10;
power += (sample < 0) ? -sample : sample; // Power average for UI vu-meter power += (sample < 0) ? -sample : sample; // Power average for UI vu-meter