mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-08-01 19:16:29 -04:00
Improved tone generator for proper frequency control. Also
features a square wave mode. Added proportional beep duration based on the RSSI as well. Now reading the current radiosonde frequency from the battery backed RAM instead starting with the same frequency all the time.
This commit is contained in:
parent
a80d91fb1e
commit
8aff0bb4d8
5 changed files with 25 additions and 22 deletions
|
@ -35,7 +35,7 @@ SondeProcessor::SondeProcessor() {
|
|||
|
||||
audio_output.configure(false);
|
||||
|
||||
tone_gen.configure(0, 1, ToneGen::tone_type::square);
|
||||
tone_gen.configure(BEEP_BASE_FREQ, 1.0, ToneGen::tone_type::sine, AUDIO_SAMPLE_RATE);
|
||||
}
|
||||
|
||||
void SondeProcessor::execute(const buffer_c8_t& buffer) {
|
||||
|
@ -135,9 +135,11 @@ void SondeProcessor::generate_silence() {
|
|||
|
||||
void SondeProcessor::pitch_rssi_config(const PitchRSSIConfigureMessage& message) {
|
||||
pitch_rssi_enabled = message.enabled;
|
||||
uint32_t tone_delta = (int) ((float) message.rssi * (float) RSSI_PITCH_WEIGHT + (float) 1000) * ((float) (1ULL << 32) / (float) 24000);
|
||||
|
||||
uint32_t freq = (int) ((float) message.rssi * (float) RSSI_PITCH_WEIGHT + (float) BEEP_BASE_FREQ);
|
||||
|
||||
last_rssi = message.rssi;
|
||||
tone_gen.configure(tone_delta, 1.0, ToneGen::tone_type::square);
|
||||
tone_gen.configure(freq, 1.0, ToneGen::tone_type::sine, AUDIO_SAMPLE_RATE);
|
||||
}
|
||||
|
||||
int main() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue