Compare commits

...

2 Commits

12 changed files with 203 additions and 114 deletions

View File

@@ -21,12 +21,12 @@ lib_deps =
;Upload protocol configuration
upload_protocol = esptool
upload_port = /dev/ttyACM1
upload_port = /dev/ttyACM2
upload_speed = 921600
;Monitor configuration
monitor_speed = 115200
monitor_port = /dev/ttyACM1
monitor_port = /dev/ttyACM2
; Build configuration
build_type = debug
@@ -39,12 +39,12 @@ lib_deps = ${env:esp32-s3-devkitc1-n16r8.lib_deps}
;Upload protocol configuration
upload_protocol = esptool
upload_port = /dev/ttyACM1
upload_port = /dev/ttyACM2
upload_speed = 921600
;Monitor configuration
monitor_speed = 115200
monitor_port = /dev/ttyACM1
monitor_port = /dev/ttyACM2
; Debug configuration
debug_tool = esp-builtin
@@ -58,4 +58,5 @@ build_flags =
-ggdb3
-DCORE_DEBUG_LEVEL=5
-DARDUINO_USB_CDC_ON_BOOT=0
-DARDUINO_USB_MODE=0
-fstack-protector-all

View File

@@ -7,12 +7,11 @@
void trig_isr(void *arg)
{
const int64_t time_us = esp_timer_get_time();
static uint8_t isr_firing_count = 0;
// exit if invalid args
if (!arg)
return;
// FOR TESTING ONLY
digitalWrite(POT_A_CS, HIGH);
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
isrParams *params = (isrParams *)arg;
@@ -23,37 +22,55 @@ void trig_isr(void *arg)
if (!task_handle)
return;
// reset spark flags, cannot be same time as trigger flags
box->coils12.spark_ok = false;
box->coils34.spark_ok = false;
switch (params->flag)
{
case TRIG_FLAG_12P:
case TRIG_FLAG_12N:
// if (isr_firing_count == 0)
{
// only on first trigger to avoid multiple firing due to noise, to be fixed with hardware debounce
isr_firing_count++;
box->coils12.spark_ok = false; // reset spark ok flag on new trigger event
box->coils12.trig_time = time_us;
xTaskNotifyFromISR(task_handle, params->flag, eSetValueWithOverwrite, &xHigherPriorityTaskWoken);
}
break;
case TRIG_FLAG_34P:
case TRIG_FLAG_34N:
// if (isr_firing_count == 0)
{
// only on first trigger to avoid multiple firing due to noise, to be fixed with hardware debounce
isr_firing_count++;
box->coils34.spark_ok = false; // reset spark ok flag on new trigger event
box->coils34.trig_time = time_us;
xTaskNotifyFromISR(task_handle, params->flag, eSetValueWithOverwrite, &xHigherPriorityTaskWoken);
}
break;
case SPARK_FLAG_12:
// if (isr_firing_count > 0) // only consider spark if a trigger has been detected, otherwise noise on spark pin can cause false positives
{
isr_firing_count = 0; // reset trigger timeout counter on spark event
box->coils34.spark_ok = false;
box->coils12.spark_ok = true;
box->coils12.spark_time = time_us;
vTaskNotifyGiveFromISR(task_handle, &xHigherPriorityTaskWoken);
xTaskNotifyFromISR(task_handle, params->flag, eSetValueWithOverwrite, &xHigherPriorityTaskWoken);
// vTaskNotifyGiveFromISR(task_handle, &xHigherPriorityTaskWoken);
}
break;
case SPARK_FLAG_34:
// if (isr_firing_count > 0) // only consider spark if a trigger has been detected, otherwise noise on spark pin can cause false positives
{
isr_firing_count = 0; // reset trigger timeout counter on spark event
box->coils12.spark_ok = false;
box->coils34.spark_ok = true;
box->coils34.spark_time = time_us;
vTaskNotifyGiveFromISR(task_handle, &xHigherPriorityTaskWoken);
xTaskNotifyFromISR(task_handle, params->flag, eSetValueWithOverwrite, &xHigherPriorityTaskWoken);
// vTaskNotifyGiveFromISR(task_handle, &xHigherPriorityTaskWoken);
}
break;
default:
break;
}
// FOR TESTING ONLY
digitalWrite(POT_A_CS, LOW);
if (xHigherPriorityTaskWoken)
portYIELD_FROM_ISR();

View File

@@ -6,6 +6,7 @@
// Arduino Libraries
#include <Arduino.h>
#include "soc/gpio_struct.h"
#include <map>
#ifndef TEST
#include "pins.h"
#else
@@ -45,34 +46,58 @@ enum sparkStatus
SPARK_SYNC_FAIL,
};
static const std::map<const sparkStatus, const char *> sparkStatusNames = {
{SPARK_POS_OK, "SPARK_POS_OK"},
{SPARK_NEG_OK, "SPARK_NEG_OK"},
{SPARK_POS_SKIP, "SPARK_POS_SKIP"},
{SPARK_NEG_SKIP, "SPARK_NEG_SKIP"},
{SPARK_POS_WAIT, "SPARK_POS_WAIT"},
{SPARK_NEG_WAIT, "SPARK_NEG_WAIT"},
{SPARK_POS_FAIL, "SPARK_POS_FAIL"},
{SPARK_NEG_FAIL, "SPARK_NEG_FAIL"},
{SPARK_POS_UNEXPECTED, "SPARK_POS_UNEXPECTED"},
{SPARK_NEG_UNEXPECTED, "SPARK_NEG_UNEXPECTED"},
{SPARK_SYNC_FAIL, "SPARK_SYNC_FAIL"},
};
enum softStartStatus
{
NORMAL,
SOFT_START
SOFT_START,
ERROR,
};
const std::map<const softStartStatus, const char *> softStartStatusNames = {
{NORMAL, "NORMAL"},
{SOFT_START, "SOFT_START"},
{ERROR, "ERROR"},
};
struct coilsStatus
{
int64_t trig_time;
int64_t spark_time;
int64_t spark_delay;
sparkStatus spark_status;
softStartStatus sstart_status;
float peak_p_in, peak_n_in;
float peak_p_out, peak_n_out;
float trigger_spark;
bool spark_ok;
int64_t trig_time = 0;
int64_t spark_time = 0;
int64_t spark_delay = 0; // in microseconds
sparkStatus spark_status = sparkStatus::SPARK_POS_OK;
softStartStatus sstart_status = softStartStatus::NORMAL;
float peak_p_in = 0.0, peak_n_in = 0.0;
float peak_p_out = 0.0, peak_n_out = 0.0;
float trigger_spark = 0.0;
bool spark_ok = false;
uint32_t n_events = 0;
};
// Task internal Status
struct ignitionBoxStatus
{
int64_t timestamp;
int64_t timestamp = 0;
// coils pairs for each ignition
coilsStatus coils12;
coilsStatus coils34;
// voltage from generator
float volts_gen = 0.0;
uint32_t n_queue_errors = 0;
};
struct isrParams

View File

@@ -25,7 +25,7 @@ void printTaskList()
void setup()
{
Serial.begin(115200);
Serial.begin(921600);
delay(250);
// Setup Logger
@@ -168,46 +168,58 @@ void loop()
LOG_INFO("Real Time Tasks A & B initialized");
////////////////////// MAIN LOOP //////////////////////
uint32_t count(0);
clearScreen();
setCursor(0, 0);
ignitionBoxStatus ignA;
int64_t last = esp_timer_get_time();
uint32_t missed_firings12 = 0;
uint32_t missed_firings34 = 0;
while (running)
{
ignitionBoxStatus ignA;
if (xQueueReceive(rt_taskA_queue, &ignA, pdMS_TO_TICKS(100)) == pdTRUE)
if (xQueueReceive(rt_taskA_queue, &ignA, pdMS_TO_TICKS(1000)) == pdTRUE)
{
if (count++ % 10000 == 0)
{
firstRun = true;
if (ignA.coils12.spark_status == sparkStatus::SPARK_NEG_FAIL || ignA.coils12.spark_status == sparkStatus::SPARK_POS_FAIL)
missed_firings12++;
if (ignA.coils34.spark_status == sparkStatus::SPARK_POS_FAIL || ignA.coils34.spark_status == sparkStatus::SPARK_NEG_FAIL)
missed_firings34++;
clearScreen();
setCursor(0, 0);
printField("++ Timestamp", (uint32_t)ignA.timestamp, 0, 0);
Serial.println("========== Coils 12 =============");
printField("Pickup Tim", (uint32_t)ignA.coils12.trig_time, 0, 1);
printField("Spark Tim", (uint32_t)ignA.coils12.spark_time, 0, 2);
printField("Events", (uint32_t)ignA.coils12.n_events, 0, 1);
printField("Missed Firing", missed_firings12, 0, 2);
printField("Spark Dly", (uint32_t)ignA.coils12.spark_delay, 0, 3);
printField("Spark Sts", (uint32_t)ignA.coils12.spark_status, 0, 4);
printField("Peak P_IN", ignA.coils12.peak_p_in, 0, 5);
printField("Peak P_OUT", ignA.coils12.peak_p_out, 0, 6);
printField("Peak N_IN", ignA.coils12.peak_n_in, 0, 7);
printField("Peak N_OUT", ignA.coils12.peak_n_out, 0, 8);
printField("SoftStart ", (uint32_t)ignA.coils12.sstart_status, 0, 9);
printField("Spark Sts", sparkStatusNames.at(ignA.coils12.spark_status), 0, 4);
// printField("Peak P_IN", ignA.coils12.peak_p_in, 0, 5);
// printField("Peak P_OUT", ignA.coils12.peak_p_out, 0, 6);
// printField("Peak N_IN", ignA.coils12.peak_n_in, 0, 7);
// printField("Peak N_OUT", ignA.coils12.peak_n_out, 0, 8);
printField("Soft Start ", softStartStatusNames.at(ignA.coils12.sstart_status), 0, 9);
Serial.println("========== Coils 34 =============");
printField("Pickup Tim", (uint32_t)ignA.coils34.trig_time, 0, 11);
printField("Spark Tim", (uint32_t)ignA.coils34.spark_time, 0, 12);
printField("Events", (uint32_t)ignA.coils34.n_events, 0, 11);
printField("Missed Firing", missed_firings34, 0, 12);
printField("Spark Dly", (uint32_t)ignA.coils34.spark_delay, 0, 13);
printField("Spark Sts", (uint32_t)ignA.coils34.spark_delay, 0, 14);
printField("Peak P_IN", ignA.coils34.peak_p_in, 0, 15);
printField("Peak P_OUT", ignA.coils34.peak_p_out, 0, 16);
printField("Peak N_IN", ignA.coils34.peak_n_in, 0, 17);
printField("Peak N_OUT", ignA.coils34.peak_n_out, 0, 18);
printField("SoftStart ", (uint32_t)ignA.coils34.sstart_status, 0, 19);
printField("Spark Sts", sparkStatusNames.at(ignA.coils34.spark_status), 0, 14);
// printField("Peak P_IN", ignA.coils34.peak_p_in, 0, 15);
// printField("Peak P_OUT", ignA.coils34.peak_p_out, 0, 16);
// printField("Peak N_IN", ignA.coils34.peak_n_in, 0, 17);
// printField("Peak N_OUT", ignA.coils34.peak_n_out, 0, 18);
printField("Soft Start ", softStartStatusNames.at(ignA.coils34.sstart_status), 0, 19);
Serial.println("========== END =============");
count = 0;
}
Serial.println();
auto delta = (esp_timer_get_time() - last) / 1000000.0f; //in seconds
delta = delta > 0 ? 1.0f / delta : 0; // Calculate frequency (Hz)
printField("Frequency (Hz)", delta, 0, 21);
printField("Queue Errors", (uint32_t)ignA.n_queue_errors, 0, 22);
last = esp_timer_get_time();
} else
{
setCursor(0, 22);
Serial.print("Waiting for data... ");;
Serial.flush();
}
}

View File

@@ -59,16 +59,16 @@
// =====================
// DIGITAL POT
// =====================
#define POT_A_CS 1
#define POT_B_CS 2
//#define POT_A_CS 1
//#define POT_B_CS 2
// =====================
// TRIGGER INPUT INTERRUPTS
// =====================
#define TRIG_PIN_A12P 18
#define TRIG_PIN_A12N 21
#define TRIG_PIN_A34P 38 // ATTENZIONEEEEEEEEEEE
#define TRIG_PIN_A34N 39 // ATTENZIONEEEEEEEEEEE
#define TRIG_PIN_A34P 1
#define TRIG_PIN_A34N 2
#define TRIG_PIN_B12P 38
#define TRIG_PIN_B12N 39
#define TRIG_PIN_B34P 40
@@ -78,9 +78,9 @@
// SPARK DETECT INPUTS
// =====================
#define SPARK_PIN_A12 42
#define SPARK_PIN_A34 42 // OK (strapping ma consentito) 45
#define SPARK_PIN_B12 42 // OK (strapping ma consentito) 46
#define SPARK_PIN_B34 42
#define SPARK_PIN_A34 45 // OK (strapping ma consentito) 45
#define SPARK_PIN_B12 46 // OK (strapping ma consentito) 46
#define SPARK_PIN_B34 47
// =====================
// PCA9555 (I2C EXPANDER)

View File

@@ -21,7 +21,7 @@ void rtIgnitionTask(void *pvParameters)
ADS1256 *adc = dev->adc_a;
PCA9555 *io = dev->io;
static ignitionBoxStatus ign_box_sts;
ignitionBoxStatus ign_box_sts;
// Variables for ISR, static to be fixed in memory locations
static isrParams isr_params_t12p{
@@ -51,8 +51,6 @@ void rtIgnitionTask(void *pvParameters)
LOG_INFO("rtTask ISR Params OK");
pinMode(POT_A_CS, OUTPUT);
// Attach Pin Interrupts
attachInterruptArg(digitalPinToInterrupt(rt_int.trig_pin_12p), rt_int.isr_ptr, (void *)&isr_params_t12p, RISING);
attachInterruptArg(digitalPinToInterrupt(rt_int.trig_pin_12n), rt_int.isr_ptr, (void *)&isr_params_t12n, RISING);
@@ -71,8 +69,9 @@ void rtIgnitionTask(void *pvParameters)
LOG_WARN("rtTask Init Correct");
// Global rt_task_ptr variables
uint32_t it = 0;
uint32_t q_fail_count = 0;
bool first_cycle = true;
bool cycle12 = false;
bool cycle34 = false;
while (params->rt_running)
{
@@ -86,6 +85,11 @@ void rtIgnitionTask(void *pvParameters)
&pickup_flag, // valore ricevuto
portMAX_DELAY);
if (first_cycle && pickup_flag != TRIG_FLAG_12P) // skip first cycle because of possible initial noise on pickup signals at startu
{
continue;
}
#ifdef DEBUG
Serial.print("\033[2J"); // clear screen
Serial.print("\033[H"); // cursor home
@@ -103,12 +107,26 @@ void rtIgnitionTask(void *pvParameters)
}
#endif
// WAIT FOR SPARK TO HAPPEN
auto spark_timeout = ulTaskNotifyTake(pdTRUE, pdMS_TO_TICKS(spark_timeout_max));
if (ign_box_sts.coils12.spark_ok || ign_box_sts.coils34.spark_ok) // otherwise timeout if none is set in the ISR
spark_flag = ign_box_sts.coils12.spark_ok ? SPARK_FLAG_12 : SPARK_FLAG_34;
else
// WAIT FOR SPARK TO HAPPEN OR TIMEOUT
// auto spark_timeout = ulTaskNotifyTake(pdTRUE, pdMS_TO_TICKS(spark_timeout_max));
// if (ign_box_sts.coils12.spark_ok || ign_box_sts.coils34.spark_ok) // otherwise timeout if none is set in the ISR
// spark_flag = ign_box_sts.coils12.spark_ok ? SPARK_FLAG_12 : SPARK_FLAG_34;
// else
// spark_flag = SPARK_FLAG_NIL;
spark_flag = SPARK_FLAG_NIL; // default value in case of timeout, to be set by ISR if spark event occours
// WAIT FOR SPARK TO HAPPEN OR TIMEOUT
auto sp = xTaskNotifyWait(
0x00, // non pulire all'ingresso
ULONG_MAX, // pulisci i primi 8 bit
&spark_flag, // valore ricevuto
pdMS_TO_TICKS(spark_timeout_max)); // wait for spark event or timeout
// timeout occurred, set spark flag to nil
if (sp == pdFALSE)
{
spark_flag = SPARK_FLAG_NIL;
}
#ifdef DEBUG
// LOG_INFO("Spark Flags: ", printBits(spark_flag).c_str());
@@ -121,11 +139,9 @@ void rtIgnitionTask(void *pvParameters)
ulTaskNotifyValueClear(NULL, 0xFFFFFFFF);
// A trigger from pickup 12 is followed by a spark event on 34 or vice versa pickup 34 triggers spark on 12
if ((pickup_flag == TRIG_FLAG_12P || pickup_flag == TRIG_FLAG_12N) && spark_flag != SPARK_FLAG_12)
if ((pickup_flag == TRIG_FLAG_12P || pickup_flag == TRIG_FLAG_12N) && (spark_flag != SPARK_FLAG_12 && spark_flag != SPARK_FLAG_NIL))
{
ign_box_sts.coils12.spark_status = ign_box_sts.coils34.spark_status = sparkStatus::SPARK_SYNC_FAIL;
// Save error on circular buffer and skip to next cycle //
LOG_ERROR("Spark Mismatch");
continue;
}
@@ -133,6 +149,7 @@ void rtIgnitionTask(void *pvParameters)
switch (pickup_flag)
{
case TRIG_FLAG_12P:
first_cycle = false;
case TRIG_FLAG_12N:
coils = &ign_box_sts.coils12;
break;
@@ -142,22 +159,20 @@ void rtIgnitionTask(void *pvParameters)
break;
}
bool new_data = false;
switch (pickup_flag)
{
case TRIG_FLAG_12P:
case TRIG_FLAG_34P:
{
LOG_INFO("POSITIVE Edge");
// Timeout not occourred, expected POSITIVE edge spark OCCOURRED
if (spark_flag != SPARK_FLAG_NIL)
{
coils->spark_delay = coils->trig_time - coils->spark_time;
coils->spark_delay = coils->spark_time - coils->trig_time;
coils->sstart_status = softStartStatus::NORMAL; // because spark on positive edge
coils->spark_status = sparkStatus::SPARK_POS_OK; // do not wait for spark on negative edge
#ifdef DEBUG
LOG_INFO("Spark on POSITIVE pulse");
LOG_INFO("Spark Delay Timer: ", (int32_t)coils->spark_delay);
LOG_INFO("Spark Delay Time: ", (int32_t)coils->spark_delay);
#endif
}
// Timeout occourred, expected POSITIVE edge spark NOT OCCOURRED
@@ -166,30 +181,28 @@ void rtIgnitionTask(void *pvParameters)
coils->spark_status = sparkStatus::SPARK_NEG_WAIT;
coils->sstart_status = softStartStatus::NORMAL;
}
new_data = false;
break; // Do nothing more on positive pulse
continue; // Do nothing more on positive pulse
}
// CASES for NEGATIVE cycle triggering of pickup and sparks 12 & 34
case TRIG_FLAG_12N:
case TRIG_FLAG_34N:
{
LOG_INFO("NEGATIVE Edge");
const bool expected_negative = coils->spark_status == sparkStatus::SPARK_NEG_WAIT;
// Timeout not occourred, expected NEGATIVE edge spark OCCOURRED
if (spark_flag != SPARK_FLAG_NIL && expected_negative)
{
coils->spark_delay = coils->trig_time - coils->spark_time;
coils->spark_delay = coils->spark_time - coils->trig_time;
coils->sstart_status = softStartStatus::SOFT_START;
coils->spark_status == sparkStatus::SPARK_NEG_OK;
coils->spark_status = sparkStatus::SPARK_NEG_OK;
#ifdef DEBUG
LOG_INFO("Spark on NEGATIVE pulse");
LOG_INFO("Spark Delay Timer: ", (int32_t)coils->spark_delay);
LOG_INFO("Spark Delay Time: ", (int32_t)coils->spark_delay);
#endif
}
// Timeout occourred, expected POSITIVE edge spark NOT OCCOURRED
else if (spark_flag == SPARK_FLAG_NIL && expected_negative)
{
coils->sstart_status = softStartStatus::NORMAL;
coils->sstart_status = softStartStatus::ERROR;
coils->spark_status = sparkStatus::SPARK_NEG_FAIL;
}
// Timeout not occouured, unexpected negative edge spark
@@ -199,7 +212,11 @@ void rtIgnitionTask(void *pvParameters)
coils->spark_status = sparkStatus::SPARK_NEG_UNEXPECTED;
}
// Wait for finish of negative pulse to save data to buffer
new_data = true;
coils->n_events++;
if (pickup_flag == TRIG_FLAG_12N)
cycle12 = true;
else
cycle34 = true;
break;
}
default:
@@ -211,8 +228,10 @@ void rtIgnitionTask(void *pvParameters)
break;
}
if (new_data)
if (cycle12 && cycle34) // wait for both 12 and 34 cycles to complete before sending data to main loop and resetting peak detectors
{
cycle12 = false;
cycle34 = false;
// vTaskDelay(pdMS_TO_TICKS(1)); // delay 1ms to allow peak detectors to charge for negative cycle
// read adc channels: pickup12, out12 [ pos + neg ]
if (adc) // read only if adc initialized
@@ -245,10 +264,10 @@ void rtIgnitionTask(void *pvParameters)
// send essage to main loop with ignition info, by copy so local static variable is ok
if (rt_queue)
ign_box_sts.timestamp = esp_timer_get_time(); // update data timestamp
if (xQueueSendToBack(rt_queue, (void *)&ign_box_sts, pdMS_TO_TICKS(1)) != pdPASS)
if (xQueueSendToBack(rt_queue, (void *)&ign_box_sts, 0) != pdPASS)
{
q_fail_count++;
// LOG_ERROR("Failed to send to rt_queue");
ign_box_sts.n_queue_errors++;
LOG_ERROR("Failed to send to rt_queue");
}
}
}

View File

@@ -2,7 +2,7 @@
#define DEBUGLOG_DEFAULT_LOG_LEVEL_DEBUG
// Serial debug flag
#define DEBUG
//#define DEBUG
// Arduino Libraries
#include <Arduino.h>
@@ -16,7 +16,7 @@
#include "devices.h"
// Global Variables and Flags
const uint8_t spark_timeout_max = 2; // in milliseconds
const uint8_t spark_timeout_max = 1; // in milliseconds
// Debug Variables
#ifdef DEBUG

View File

@@ -46,3 +46,14 @@ void printField(const char name[], const float val, const uint8_t x, const uint8
Serial.print(val);
Serial.flush();
}
void printField(const char name[], const char *val, const uint8_t x, const uint8_t y) {
if (firstRun) {
setCursor(x,y);
Serial.printf("%15s: %s\n", name, val);
return;
}
setCursor(x+16, y);
Serial.print(val);
Serial.flush();
}

View File

@@ -1,7 +1,7 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"Jason2866.esp-decoder",
"pioarduino.pioarduino-ide",
"platformio.platformio-ide"
],
"unwantedRecommendations": [

View File

@@ -10,7 +10,7 @@
[env:esp32-devtest-release]
board = esp32dev
platform = https://github.com/pioarduino/platform-espressif32/releases/download/55.03.37/platform-espressif32.zip
platform = https://github.com/pioarduino/platform-espressif32/releases/download/stable/platform-espressif32.zip
framework = arduino
lib_deps =
hideakitai/DebugLog@^0.8.4
@@ -21,8 +21,8 @@ build_type = release
[env:esp32-devtest-debug]
board = esp32dev
platform = https://github.com/pioarduino/platform-espressif32/releases/download/55.03.37/platform-espressif32.zip
framework = arduino
platform = https://github.com/pioarduino/platform-espressif32/releases/download/stable/platform-espressif32.zip
lib_deps =
hideakitai/DebugLog@^0.8.4
board_build.flash_size = 4MB

View File

@@ -15,7 +15,7 @@ static uint32_t count = 0;
#define SPARK_DLY_MIN 10
#define SPARK_DLY_MAX 490
#define PAUSE_LONG_MIN 10000
#define PAUSE_LONG_MIN 5000
#define PAUSE_LONG_MAX PAUSE_LONG_MIN*100
void clearScreen(){
@@ -46,15 +46,16 @@ static timerStatus stsA = {
.clock_period_us = (uint32_t)PERIOD_US,
.pause_long_us = 10000,
.pause_short_us = 1000,
.coil_pulse_us = 500,
.spark_pulse_us = 50,
.spark_delay_us = 10,
.coil_pulse_us = 1000,
.spark_pulse_us = 100,
.spark_delay_us = 50,
.main_task = NULL};
void setup()
{
Serial.begin(115200);
delay(1000);
LOG_ATTACH_SERIAL(Serial);
pinMode(PIN_TRIG_A12P, OUTPUT);
@@ -98,6 +99,9 @@ void loop()
stsA.pause_long_us = (uint32_t)filtered;
LOG_INFO("Spark Delay uS: ", stsA.spark_delay_us, "\tSoft Start: ", stsA.soft_start ? "TRUE" : "FALSE");
LOG_INFO("Pause: ", (uint32_t)(stsA.pause_long_us / 1000), "ms");
LOG_INFO("Coil Pulse: ", stsA.coil_pulse_us, "us");
LOG_INFO("Spark Pulse: ", stsA.spark_pulse_us, "us");
delay(100);
clearScreen();

View File

@@ -19,5 +19,5 @@
#define SPARK_B34 5
// Pot
#define SPARK_DELAY_POT 12
#define SPARK_DELAY_POT 13
#define FREQ_POT 14