Compare commits

..

No commits in common. "d92b3da418aa9f185e1a61fe1a45d5ff649940c0" and "1a54d4bc59eb0bd38bba0f9fc673129e9a97d299" have entirely different histories.

4 changed files with 19 additions and 46 deletions

1
.gitignore vendored
View file

@ -1,2 +1 @@
.DS_Store .DS_Store
ESP32_Oscilloscope/build

View file

@ -6,7 +6,6 @@
#include <driver/adc.h> #include <driver/adc.h>
#include <soc/syscon_reg.h> #include <soc/syscon_reg.h>
#include <User_Setup.h>
#include <TFT_eSPI.h> #include <TFT_eSPI.h>
#include <SPI.h> #include <SPI.h>
@ -18,21 +17,8 @@
#define DEBUG_DELAY 250 #define DEBUG_DELAY 250
// Width and height of sprite // Width and height of sprite
#ifdef ILI9341_DRIVER
#warning "Use ILI9341 display settings."
#define DISPLAY_HEIGHT 240 #define DISPLAY_HEIGHT 240
#define DISPLAY_WIDTH 320 #define DISPLAY_WIDTH 320
#endif
#ifdef ST7789_DRIVER
#warning "Use ST7789 display settings."
#define DISPLAY_HEIGHT 240
#define DISPLAY_WIDTH 280
#endif
#ifndef DISPLAY_HEIGHT
#error "No display driver defined"
#endif
#define ADC_CHANNEL ADC1_CHANNEL_5 // GPIO33 #define ADC_CHANNEL ADC1_CHANNEL_5 // GPIO33
#define NUM_SAMPLES 1000 // number of samples #define NUM_SAMPLES 1000 // number of samples
@ -128,10 +114,6 @@ void IRAM_ATTR btback()
void setup() { void setup() {
Serial.begin(115200); Serial.begin(115200);
esp_reset_reason_t reset_reason = esp_reset_reason();
Serial.print("Reset reason: ");
Serial.println(reset_reason);
configure_i2s(1000000); configure_i2s(1000000);
setup_screen(); setup_screen();
@ -211,7 +193,6 @@ void core1_task(void *pvParameters)
if (stop_change) if (stop_change)
{ {
i2s_adc_enable(I2S_NUM_0); i2s_adc_enable(I2S_NUM_0);
i2s_zero_dma_buffer(I2S_NUM_0);
stop_change = false; stop_change = false;
} }
ADC_Sampling(i2s_buff); ADC_Sampling(i2s_buff);
@ -221,8 +202,7 @@ void core1_task(void *pvParameters)
{ {
if (!stop_change) if (!stop_change)
{ {
// TODO the disable function causes an esp32 reset i2s_adc_disable(I2S_NUM_0);
//i2s_adc_disable(I2S_NUM_0);
i2s_zero_dma_buffer(I2S_NUM_0); i2s_zero_dma_buffer(I2S_NUM_0);
stop_change = true; stop_change = true;
} }
@ -230,7 +210,7 @@ void core1_task(void *pvParameters)
// Serial.println("CORE1"); // Serial.println("CORE1");
vTaskDelay(pdMS_TO_TICKS(300)); vTaskDelay(pdMS_TO_TICKS(300));
} }
else // else single trigger else
{ {
float old_mean = 0; float old_mean = 0;
while (single_trigger) while (single_trigger)

View file

@ -132,7 +132,6 @@ void button()
{ {
set_value = 0; set_value = 0;
btnbk = 0; btnbk = 0;
btnok = 0;
} }
} }
else else
@ -144,8 +143,8 @@ void button()
{ {
opt = 1; opt = 1;
} }
//Serial.print("option : "); Serial.print("option : ");
//Serial.println(opt); Serial.println(opt);
btnpl = 0; btnpl = 0;
} }
if (btnmn == 1) if (btnmn == 1)
@ -155,8 +154,8 @@ void button()
{ {
opt = 9; opt = 9;
} }
//Serial.print("option : "); Serial.print("option : ");
//Serial.println(opt); Serial.println(opt);
btnmn = 0; btnmn = 0;
} }
if (btnbk == 1) if (btnbk == 1)
@ -173,19 +172,29 @@ void button()
break; break;
case Vdiv: case Vdiv:
set_value = true;
break;
case Sdiv: case Sdiv:
set_value = true;
break;
case Offset: case Offset:
case TOffset:
set_value = true; set_value = true;
break; break;
case Stop: case Stop:
stop = !stop; stop = !stop;
//Serial.print("Stop : "); Serial.print("Stop : ");
//Serial.println(stop); Serial.println(stop);
set_value = false; set_value = false;
break; break;
case TOffset:
set_value = true;
// set_value = false;
break;
case Single: case Single:
single_trigger = true; single_trigger = true;
set_value = false; set_value = false;

View file

@ -1,12 +1,7 @@
void setup_screen() { void setup_screen() {
// Initialise the TFT registers // Initialise the TFT registers
tft.init(); tft.init();
#ifdef ILI9341_DRIVER
tft.setRotation(3); tft.setRotation(3);
#endif
#ifdef ST7789_DRIVER
tft.setRotation(1);
#endif
// Optionally set colour depth to 8 or 16 bits, default is 16 if not spedified // Optionally set colour depth to 8 or 16 bits, default is 16 if not spedified
spr.setColorDepth(8); spr.setColorDepth(8);
@ -170,12 +165,7 @@ void draw_sprite(float freq,
draw_channel1(trigger, 0, i2s_buff, sample_rate); draw_channel1(trigger, 0, i2s_buff, sample_rate);
} }
#ifdef ILI9341_DRIVER
int shift = DISPLAY_WIDTH - 130;
#endif
#ifdef ST7789_DRIVER
int shift = DISPLAY_WIDTH - 110; int shift = DISPLAY_WIDTH - 110;
#endif
if (menu) { if (menu) {
spr.drawLine( 0, DISPLAY_HEIGHT/2, DISPLAY_WIDTH, DISPLAY_HEIGHT/2, TFT_WHITE); //center line spr.drawLine( 0, DISPLAY_HEIGHT/2, DISPLAY_WIDTH, DISPLAY_HEIGHT/2, TFT_WHITE); //center line
spr.fillRect(shift, 0, (DISPLAY_HEIGHT/2)-18, (DISPLAY_HEIGHT/2)+15, TFT_BLACK); spr.fillRect(shift, 0, (DISPLAY_HEIGHT/2)-18, (DISPLAY_HEIGHT/2)+15, TFT_BLACK);
@ -209,12 +199,7 @@ void draw_sprite(float freq,
spr.drawString(offset_line, shift + 25, (DISPLAY_HEIGHT/2)-8); spr.drawString(offset_line, shift + 25, (DISPLAY_HEIGHT/2)-8);
if (set_value) { if (set_value) {
#ifdef ILI9341_DRIVER
uint16_t t_left = shift+161; uint16_t t_left = shift+161;
#endif
#ifdef ST7789_DRIVER
uint16_t t_left = shift+149; // previously hard coeded value 229
#endif
// Plus symbols while setting a value // Plus symbols while setting a value
spr.fillRect(t_left, 0, 11, 11, TFT_BLUE); spr.fillRect(t_left, 0, 11, 11, TFT_BLUE);
spr.drawRect(t_left, 0, 11, 11, TFT_WHITE); spr.drawRect(t_left, 0, 11, 11, TFT_WHITE);