End-Of-Session: WIP commands, invert input logic cause pullups
This commit is contained in:
parent
9aa1838a26
commit
e10e6eddbf
15
README.md
15
README.md
@ -1,3 +1,16 @@
|
||||
# Eck Eck
|
||||
|
||||
![EckEckEckEck.gif](https://media-be.chewy.com/wp-content/uploads/2023/05/05165809/cat-chattering-chirping-at-birds.gif)
|
||||
![EckEckEckEck.gif](https://media-be.chewy.com/wp-content/uploads/2023/05/05165809/cat-chattering-chirping-at-birds.gif)
|
||||
|
||||
|
||||
### Current WIP issue:
|
||||
|
||||
command issue:
|
||||
|
||||
```
|
||||
.........................................................SR D
|
||||
...........SR 1
|
||||
..............................SR
|
||||
Processing input: D1
|
||||
Command: D -
|
||||
```
|
||||
|
@ -12,3 +12,4 @@
|
||||
platform = atmelavr
|
||||
board = nanoatmega328
|
||||
framework = arduino
|
||||
monitor_speed = 115200
|
||||
|
28
src/main.cpp
28
src/main.cpp
@ -51,21 +51,21 @@ void setup() {
|
||||
adjust_length(p_buf);
|
||||
log("Setup complete\n");
|
||||
log("Dit length: ");
|
||||
log(dit);
|
||||
log(String(dit));
|
||||
log("\n");
|
||||
log("Dah length: ");
|
||||
log(dah);
|
||||
log(String(dah));
|
||||
log("\n");
|
||||
log("Potentiometer: ");
|
||||
log(p_buf);
|
||||
log(String(p_buf));
|
||||
log("\n");
|
||||
}
|
||||
|
||||
void loop() {
|
||||
log(".");
|
||||
if (digitalRead(input_dah)){
|
||||
if (!digitalRead(input_dah)){
|
||||
send(true);
|
||||
}else if (digitalRead(input_dit)){
|
||||
}else if (!digitalRead(input_dit)){
|
||||
send(false);
|
||||
}
|
||||
|
||||
@ -83,7 +83,7 @@ void loop() {
|
||||
if (Serial.available() > 0) {
|
||||
buf = Serial.read();
|
||||
log("SR ");
|
||||
log(buf);
|
||||
log(String(buf));
|
||||
log("\n");
|
||||
if ((uint16_t) buf == 13){
|
||||
process_input(serial_buffer);
|
||||
@ -96,8 +96,8 @@ void loop() {
|
||||
delay(debounce);
|
||||
}
|
||||
|
||||
void adjust_length(uint8_t adjusted_length){
|
||||
uint16_t new_dah = map(adjusted_length, 0, 1023, p_min, p_max);
|
||||
void adjust_length(uint16_t adjusted_length){
|
||||
uint16_t new_dah = map(adjusted_length, 20, 1000, p_min, p_max);
|
||||
set_length(new_dah/2, new_dah);
|
||||
}
|
||||
|
||||
@ -112,6 +112,11 @@ void process_input(String input){
|
||||
log("\n");
|
||||
char command = input[0];
|
||||
input.remove(0);
|
||||
log("Command: ");
|
||||
log(String(command));
|
||||
log(" - ");
|
||||
log(input);
|
||||
log("\n");
|
||||
uint16_t length = 0;
|
||||
switch(command){
|
||||
case 'S':
|
||||
@ -126,7 +131,7 @@ void process_input(String input){
|
||||
set_length(dit, length);
|
||||
break;
|
||||
case 'D':
|
||||
debug = input.toInt()==1;
|
||||
debug = boolean(input.toInt()==1);
|
||||
EEPROM.write(22, debug);
|
||||
break;
|
||||
default:
|
||||
@ -146,9 +151,10 @@ void send(bool b) {
|
||||
|
||||
void set_length(uint16_t length_dit, uint16_t length_dah) {
|
||||
log("Setting dit length to ");
|
||||
log(length_dit);
|
||||
log(String(length_dit));
|
||||
log(" and dah length to ");
|
||||
log(length_dah);
|
||||
log(String(length_dah));
|
||||
log("\n");
|
||||
dit = length_dit;
|
||||
dah = length_dah;
|
||||
EEPROM.write(20, length_dit);
|
||||
|
Loading…
Reference in New Issue
Block a user