parent
cd7a62018d
commit
ebe5e87049
|
@ -25,8 +25,8 @@
|
|||
/*----------------*/
|
||||
|
||||
/*INFO*/
|
||||
unsigned long frequency = 1000, duty = 50, type = 1;
|
||||
float Vpp = 24.0, Voff = 12.0;
|
||||
unsigned long frequency = 1000, duty = 50, type = 0;
|
||||
float Vpp = 6.4, Voff = 0.0;
|
||||
/*-----------*/
|
||||
|
||||
int pushbutton, old_pushbutton;
|
||||
|
@ -117,6 +117,7 @@ void editMode(){
|
|||
break;
|
||||
}
|
||||
}else if(editing_step == 1) {
|
||||
if(type!=1) editing_step++;
|
||||
currently_editing = &duty;
|
||||
lcd.setCursor(0,0);
|
||||
lcd.print("Duty: ");
|
||||
|
@ -178,6 +179,7 @@ void communicateChanges(){
|
|||
unsigned long t1 = millis();
|
||||
boolean b = false;
|
||||
|
||||
Serial1.flush();
|
||||
digitalWrite(LED_BUILTIN, HIGH);
|
||||
while(Serial1.read() != 42){ //The answer to Life, Universe, And Everything Else
|
||||
if(millis() - t1 > 100){
|
||||
|
@ -206,6 +208,8 @@ void communicateChanges(){
|
|||
lcd.clear();
|
||||
|
||||
//Built the string with the info and set it to the teensy until a positive response is received
|
||||
Serial1.flush();
|
||||
|
||||
while(Serial1.read() != 69){
|
||||
if(millis() - t1 > 250){
|
||||
|
||||
|
|
|
@ -222,12 +222,14 @@
|
|||
"PLATFORMIO=50101",
|
||||
"__MK64FX512__",
|
||||
"ARDUINO_TEENSY35",
|
||||
"TEENSY_OPT_FASTEST_PURE_CODE_LTO",
|
||||
"USB_SERIAL",
|
||||
"ARDUINO=10805",
|
||||
"TEENSYDUINO=153",
|
||||
"CORE_TEENSY",
|
||||
"F_CPU=120000000L",
|
||||
"F_CPU=168000000L",
|
||||
"LAYOUT_US_ENGLISH",
|
||||
"__PURE_CODE__",
|
||||
""
|
||||
],
|
||||
"cppStandard": "c++14",
|
||||
|
@ -237,6 +239,7 @@
|
|||
"-mcpu=cortex-m4",
|
||||
"-mfloat-abi=hard",
|
||||
"-mfpu=fpv4-sp-d16",
|
||||
"-mpure-code",
|
||||
""
|
||||
]
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
// Sampling frequency of the DAC
|
||||
// Since the teensy runs on 168MHz and Fastest + LTO, using the DAC sampling frequency (1428571Hz) from the Datasheet kinda falls apart
|
||||
#define SAMPLE_FREQ 6222000
|
||||
#define SAMPLE_FREQ 6988800
|
||||
|
||||
//Max Freq with good results achievable with Teensy 3.5 DAC
|
||||
#define MAX_ACHIEVABLE_FREQ 1000000
|
||||
|
|
|
@ -26,15 +26,18 @@ void setup() {
|
|||
|
||||
void loop() {
|
||||
if(receivingInfo){
|
||||
|
||||
Serial1.write(42); //The answer to life, universe and everything else
|
||||
digitalWriteFast(LED_BUILTIN, HIGH);
|
||||
|
||||
Serial1.flush();
|
||||
|
||||
delay(1000);
|
||||
receivingInfo = false;
|
||||
valid_flag = false;
|
||||
|
||||
while(!valid_flag){
|
||||
s = Serial1.readStringUntil('W');
|
||||
while(Serial1.available()) s = Serial1.readStringUntil('W');
|
||||
Serial.println(s);
|
||||
//Check if it's a valid string, it should start with 'w'
|
||||
if(!s.startsWith('w')) continue;
|
||||
|
@ -52,8 +55,6 @@ void loop() {
|
|||
for(int i = 0; i < 100; i++) Serial1.write(69);
|
||||
valid_flag = true;
|
||||
|
||||
Serial1.flush();
|
||||
|
||||
valid_flag = true;
|
||||
Serial.print("Type: " );
|
||||
Serial.println(type);
|
||||
|
|
Loading…
Reference in New Issue