better serial

This commit is contained in:
Elizabeth Cray 2025-01-19 16:54:25 -05:00
parent f0ea6b2707
commit 3926833963

View File

@ -14,6 +14,7 @@
#include <Arduino.h>
#include <EEPROM.h>
#include <ctype.h>
#include "cw.h"
/* TODO:
@ -26,7 +27,7 @@ uint8_t input_dit = 3, input_dah = 6, input_pot = A6;
uint8_t output = 7;
uint16_t dit = 200, dah = 500;
uint8_t debounce = 50;
uint16_t p_tol = 10, p_min = 50, p_max = 2000, p_buf = 0, p_cache = 0;
uint16_t p_tol = 30, p_min = 50, p_max = 2000, p_buf = 0, p_cache = 0;
String serial_buffer = "";
char buf;
@ -50,7 +51,7 @@ void setup() {
dah = EEPROM.read(21);
debug = EEPROM.read(22);
p_buf = analogRead(input_pot);
adjust_length(p_buf);
// adjust_length(p_buf);
log("Setup complete\n");
log("Dit length: ");
log(String(dit));
@ -116,6 +117,10 @@ void process_input(String input){
log(input);
log("\n");
uint16_t length = 0;
if (islower(command)){
command = toupper(command);
}
switch(command){
case 'S':
key_string(input);
@ -158,7 +163,7 @@ void key_string(String input){
delay(dit);
} else {
if (debug){
Serial.print(" ");
Serial.println("");
}
delay(dah);
}