Compare commits
No commits in common. "d92b3da418aa9f185e1a61fe1a45d5ff649940c0" and "1a54d4bc59eb0bd38bba0f9fc673129e9a97d299" have entirely different histories.
d92b3da418
...
1a54d4bc59
4 changed files with 19 additions and 46 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,2 +1 @@
|
|||
.DS_Store
|
||||
ESP32_Oscilloscope/build
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
#include <driver/adc.h>
|
||||
#include <soc/syscon_reg.h>
|
||||
|
||||
#include <User_Setup.h>
|
||||
#include <TFT_eSPI.h>
|
||||
|
||||
#include <SPI.h>
|
||||
|
@ -18,21 +17,8 @@
|
|||
#define DEBUG_DELAY 250
|
||||
|
||||
// Width and height of sprite
|
||||
#ifdef ILI9341_DRIVER
|
||||
#warning "Use ILI9341 display settings."
|
||||
#define DISPLAY_HEIGHT 240
|
||||
#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 NUM_SAMPLES 1000 // number of samples
|
||||
|
@ -128,10 +114,6 @@ void IRAM_ATTR btback()
|
|||
void setup() {
|
||||
Serial.begin(115200);
|
||||
|
||||
esp_reset_reason_t reset_reason = esp_reset_reason();
|
||||
Serial.print("Reset reason: ");
|
||||
Serial.println(reset_reason);
|
||||
|
||||
configure_i2s(1000000);
|
||||
|
||||
setup_screen();
|
||||
|
@ -211,7 +193,6 @@ void core1_task(void *pvParameters)
|
|||
if (stop_change)
|
||||
{
|
||||
i2s_adc_enable(I2S_NUM_0);
|
||||
i2s_zero_dma_buffer(I2S_NUM_0);
|
||||
stop_change = false;
|
||||
}
|
||||
ADC_Sampling(i2s_buff);
|
||||
|
@ -221,8 +202,7 @@ void core1_task(void *pvParameters)
|
|||
{
|
||||
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);
|
||||
stop_change = true;
|
||||
}
|
||||
|
@ -230,7 +210,7 @@ void core1_task(void *pvParameters)
|
|||
// Serial.println("CORE1");
|
||||
vTaskDelay(pdMS_TO_TICKS(300));
|
||||
}
|
||||
else // else single trigger
|
||||
else
|
||||
{
|
||||
float old_mean = 0;
|
||||
while (single_trigger)
|
||||
|
|
|
@ -132,7 +132,6 @@ void button()
|
|||
{
|
||||
set_value = 0;
|
||||
btnbk = 0;
|
||||
btnok = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -144,8 +143,8 @@ void button()
|
|||
{
|
||||
opt = 1;
|
||||
}
|
||||
//Serial.print("option : ");
|
||||
//Serial.println(opt);
|
||||
Serial.print("option : ");
|
||||
Serial.println(opt);
|
||||
btnpl = 0;
|
||||
}
|
||||
if (btnmn == 1)
|
||||
|
@ -155,8 +154,8 @@ void button()
|
|||
{
|
||||
opt = 9;
|
||||
}
|
||||
//Serial.print("option : ");
|
||||
//Serial.println(opt);
|
||||
Serial.print("option : ");
|
||||
Serial.println(opt);
|
||||
btnmn = 0;
|
||||
}
|
||||
if (btnbk == 1)
|
||||
|
@ -173,19 +172,29 @@ void button()
|
|||
break;
|
||||
|
||||
case Vdiv:
|
||||
set_value = true;
|
||||
break;
|
||||
|
||||
case Sdiv:
|
||||
set_value = true;
|
||||
break;
|
||||
|
||||
case Offset:
|
||||
case TOffset:
|
||||
set_value = true;
|
||||
break;
|
||||
|
||||
case Stop:
|
||||
stop = !stop;
|
||||
//Serial.print("Stop : ");
|
||||
//Serial.println(stop);
|
||||
Serial.print("Stop : ");
|
||||
Serial.println(stop);
|
||||
set_value = false;
|
||||
break;
|
||||
|
||||
case TOffset:
|
||||
set_value = true;
|
||||
// set_value = false;
|
||||
break;
|
||||
|
||||
case Single:
|
||||
single_trigger = true;
|
||||
set_value = false;
|
||||
|
|
|
@ -1,12 +1,7 @@
|
|||
void setup_screen() {
|
||||
// Initialise the TFT registers
|
||||
tft.init();
|
||||
#ifdef ILI9341_DRIVER
|
||||
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
|
||||
spr.setColorDepth(8);
|
||||
|
@ -170,12 +165,7 @@ void draw_sprite(float freq,
|
|||
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;
|
||||
#endif
|
||||
if (menu) {
|
||||
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);
|
||||
|
@ -209,12 +199,7 @@ void draw_sprite(float freq,
|
|||
spr.drawString(offset_line, shift + 25, (DISPLAY_HEIGHT/2)-8);
|
||||
|
||||
if (set_value) {
|
||||
#ifdef ILI9341_DRIVER
|
||||
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
|
||||
spr.fillRect(t_left, 0, 11, 11, TFT_BLUE);
|
||||
spr.drawRect(t_left, 0, 11, 11, TFT_WHITE);
|
||||
|
|
Loading…
Reference in a new issue