commit - b12256f6688bf8dc65df430bac6fe40e1d188353
commit + 8211b9cb69a48d026b6d75f215674bf035e974a1
blob - 08f628fcb8a927850ac0f5c05918a77a04a3b658
blob + 7b541463b15b7555948c083750fed9bd743bc2bc
--- Morse.cpp
+++ Morse.cpp
#define D_WPM 15
+#define MAX_RAD 127.5
+
#define UNIT_T(x) (60.0 / (50.0 * (float)x)) * 1000.0
-#define SINE_W(x) (sin(x) * 127.5 + 127.5)
volatile uint8_t gpio_wpm, dac_wpm;
uint8_t adc_inited;
-float dac_i = 0.0, dac_max = 6.283;
+float dac_i = 0.0, dac_max = 6.283, volume;
unsigned long gpio_tx_start_millis, gpio_tx_current_millis;
unsigned long gpio_handle_unit_millis;
if (dac_inited) {
dac_handle_chars();
if (dac_on) {
- dac_i += .125;
+ dac_i += .02;
if (dac_i >= dac_max)
dac_i = 0.0;
- dacWrite(dac_tx_pin, SINE_W(dac_i));
+ volume = (MAX_RAD * (dac_volume / 100.0));
+ dacWrite(dac_tx_pin, sin(dac_i) * volume + volume);
}
}
}
blob - 363392aff0252a5265a2352d94626d3c695f0421
blob + 2c689220dd6e95ff05605aff350c671df17848b2
--- Morse.h
+++ Morse.h
{
// we've no rx code yet
public:
+ float dac_volume = 100;
+
Morse(uint8_t type, uint8_t the_pin);
Morse(uint8_t type, uint8_t the_pin, uint8_t the_wpm);