Test Softs start working
This commit is contained in:
@@ -72,8 +72,14 @@ void setup()
|
|||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
LOG_INFO("Loop: ", count++);
|
LOG_INFO("Loop: ", count++);
|
||||||
uint32_t spark_delay = (uint32_t)(map(analogRead(12), 0, 4096, 100, 1000) / PERIOD_US);
|
uint32_t spark_delay = (uint32_t)(map(analogRead(12), 0, 4096, 100, 800) / PERIOD_US);
|
||||||
stsA.spark_delay_us = spark_delay * PERIOD_US;
|
stsA.spark_delay_us = spark_delay * PERIOD_US;
|
||||||
LOG_INFO("Spark Delay uS: ", stsA.spark_delay_us);
|
if (stsA.spark_delay_us > 500) {
|
||||||
|
stsA.soft_start = true;
|
||||||
|
stsA.spark_delay_us -= 500;
|
||||||
|
} else {
|
||||||
|
stsA.soft_start = false;
|
||||||
|
}
|
||||||
|
LOG_INFO("Spark Delay uS: ", stsA.spark_delay_us, "\tSoft Start: ", stsA.soft_start ? "TRUE" : "FALSE");
|
||||||
delay(500);
|
delay(500);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,30 +19,33 @@ void onTimer(void *arg)
|
|||||||
case S_12P:
|
case S_12P:
|
||||||
if (params->state_time == params->clock_period_us && !params->coil12p_high)
|
if (params->state_time == params->clock_period_us && !params->coil12p_high)
|
||||||
{
|
{
|
||||||
//xTaskNotifyFromISR(task, PIN_TRIG_A12P, eSetValueWithOverwrite, &xHigherPriorityTaskWoken);
|
// xTaskNotifyFromISR(task, PIN_TRIG_A12P, eSetValueWithOverwrite, &xHigherPriorityTaskWoken);
|
||||||
digitalWrite(PIN_TRIG_A12P, HIGH);
|
digitalWrite(PIN_TRIG_A12P, HIGH);
|
||||||
params->coil12p_high = true;
|
params->coil12p_high = true;
|
||||||
wait_sent = false;
|
wait_sent = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!params->soft_start)
|
||||||
|
{
|
||||||
if (params->state_time == params->spark_delay_us)
|
if (params->state_time == params->spark_delay_us)
|
||||||
{
|
{
|
||||||
//xTaskNotifyFromISR(task, SPARK_A12, eSetValueWithOverwrite, &xHigherPriorityTaskWoken);
|
// xTaskNotifyFromISR(task, SPARK_A12, eSetValueWithOverwrite, &xHigherPriorityTaskWoken);
|
||||||
digitalWrite(SPARK_A12, HIGH);
|
digitalWrite(SPARK_A12, HIGH);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (params->state_time >= params->coil_pulse_us && params->coil12p_high)
|
|
||||||
{
|
|
||||||
//xTaskNotifyFromISR(task, ~PIN_TRIG_A12P, eSetValueWithOverwrite, &xHigherPriorityTaskWoken);
|
|
||||||
digitalWrite(PIN_TRIG_A12P, LOW);
|
|
||||||
params->coil12p_high = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (params->state_time == (params->spark_delay_us + params->spark_pulse_us))
|
if (params->state_time == (params->spark_delay_us + params->spark_pulse_us))
|
||||||
{
|
{
|
||||||
//xTaskNotifyFromISR(task, ~SPARK_A12, eSetValueWithOverwrite, &xHigherPriorityTaskWoken);
|
// xTaskNotifyFromISR(task, ~SPARK_A12, eSetValueWithOverwrite, &xHigherPriorityTaskWoken);
|
||||||
digitalWrite(SPARK_A12, LOW);
|
digitalWrite(SPARK_A12, LOW);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (params->state_time >= params->coil_pulse_us && params->coil12p_high)
|
||||||
|
{
|
||||||
|
// xTaskNotifyFromISR(task, ~PIN_TRIG_A12P, eSetValueWithOverwrite, &xHigherPriorityTaskWoken);
|
||||||
|
digitalWrite(PIN_TRIG_A12P, LOW);
|
||||||
|
params->coil12p_high = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (params->state_time >= params->pause_short_us)
|
if (params->state_time >= params->pause_short_us)
|
||||||
{
|
{
|
||||||
@@ -54,14 +57,29 @@ void onTimer(void *arg)
|
|||||||
case S_12N:
|
case S_12N:
|
||||||
if (params->state_time == params->clock_period_us && !params->coil12n_high)
|
if (params->state_time == params->clock_period_us && !params->coil12n_high)
|
||||||
{
|
{
|
||||||
//xTaskNotifyFromISR(task, PIN_TRIG_A12N, eSetValueWithOverwrite, &xHigherPriorityTaskWoken);
|
// xTaskNotifyFromISR(task, PIN_TRIG_A12N, eSetValueWithOverwrite, &xHigherPriorityTaskWoken);
|
||||||
digitalWrite(PIN_TRIG_A12N, HIGH);
|
digitalWrite(PIN_TRIG_A12N, HIGH);
|
||||||
params->coil12n_high = true;
|
params->coil12n_high = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (params->soft_start)
|
||||||
|
{
|
||||||
|
if (params->state_time == params->spark_delay_us)
|
||||||
|
{
|
||||||
|
// xTaskNotifyFromISR(task, SPARK_A12, eSetValueWithOverwrite, &xHigherPriorityTaskWoken);
|
||||||
|
digitalWrite(SPARK_A12, HIGH);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (params->state_time == (params->spark_delay_us + params->spark_pulse_us))
|
||||||
|
{
|
||||||
|
// xTaskNotifyFromISR(task, ~SPARK_A12, eSetValueWithOverwrite, &xHigherPriorityTaskWoken);
|
||||||
|
digitalWrite(SPARK_A12, LOW);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (params->state_time >= params->coil_pulse_us && params->coil12n_high)
|
if (params->state_time >= params->coil_pulse_us && params->coil12n_high)
|
||||||
{
|
{
|
||||||
//xTaskNotifyFromISR(task, ~PIN_TRIG_A12N, eSetValueWithOverwrite, &xHigherPriorityTaskWoken);
|
// xTaskNotifyFromISR(task, ~PIN_TRIG_A12N, eSetValueWithOverwrite, &xHigherPriorityTaskWoken);
|
||||||
digitalWrite(PIN_TRIG_A12N, LOW);
|
digitalWrite(PIN_TRIG_A12N, LOW);
|
||||||
params->coil12n_high = false;
|
params->coil12n_high = false;
|
||||||
params->state = S_WAIT_10MS;
|
params->state = S_WAIT_10MS;
|
||||||
@@ -72,7 +90,7 @@ void onTimer(void *arg)
|
|||||||
case S_WAIT_10MS:
|
case S_WAIT_10MS:
|
||||||
if (!wait_sent)
|
if (!wait_sent)
|
||||||
{
|
{
|
||||||
//xTaskNotifyFromISR(task, S_WAIT_10MS, eSetValueWithOverwrite, &xHigherPriorityTaskWoken);
|
// xTaskNotifyFromISR(task, S_WAIT_10MS, eSetValueWithOverwrite, &xHigherPriorityTaskWoken);
|
||||||
wait_sent = true;
|
wait_sent = true;
|
||||||
}
|
}
|
||||||
if (params->state_time >= params->pause_long_us)
|
if (params->state_time >= params->pause_long_us)
|
||||||
@@ -85,30 +103,33 @@ void onTimer(void *arg)
|
|||||||
case S_34P:
|
case S_34P:
|
||||||
if (params->state_time == params->clock_period_us && !params->coil34p_high)
|
if (params->state_time == params->clock_period_us && !params->coil34p_high)
|
||||||
{
|
{
|
||||||
//xTaskNotifyFromISR(task, PIN_TRIG_A34P, eSetValueWithOverwrite, &xHigherPriorityTaskWoken);
|
// xTaskNotifyFromISR(task, PIN_TRIG_A34P, eSetValueWithOverwrite, &xHigherPriorityTaskWoken);
|
||||||
digitalWrite(PIN_TRIG_A34P, HIGH);
|
digitalWrite(PIN_TRIG_A34P, HIGH);
|
||||||
params->coil34p_high;
|
params->coil34p_high;
|
||||||
wait_sent = false;
|
wait_sent = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (params->state_time == params->spark_delay_us)
|
|
||||||
{
|
|
||||||
//xTaskNotifyFromISR(task, SPARK_A34, eSetValueWithOverwrite, &xHigherPriorityTaskWoken);
|
|
||||||
digitalWrite(SPARK_A34, HIGH);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (params->state_time >= params->coil_pulse_us && params->coil34p_high)
|
if (params->state_time >= params->coil_pulse_us && params->coil34p_high)
|
||||||
{
|
{
|
||||||
//xTaskNotifyFromISR(task, ~PIN_TRIG_A34P, eSetValueWithOverwrite, &xHigherPriorityTaskWoken);
|
// xTaskNotifyFromISR(task, ~PIN_TRIG_A34P, eSetValueWithOverwrite, &xHigherPriorityTaskWoken);
|
||||||
digitalWrite(PIN_TRIG_A34P, LOW);
|
digitalWrite(PIN_TRIG_A34P, LOW);
|
||||||
params->coil34p_high = false;
|
params->coil34p_high = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!params->soft_start)
|
||||||
|
{
|
||||||
|
if (params->state_time == params->spark_delay_us)
|
||||||
|
{
|
||||||
|
// xTaskNotifyFromISR(task, SPARK_A34, eSetValueWithOverwrite, &xHigherPriorityTaskWoken);
|
||||||
|
digitalWrite(SPARK_A34, HIGH);
|
||||||
|
}
|
||||||
|
|
||||||
if (params->state_time == params->spark_delay_us + params->spark_pulse_us)
|
if (params->state_time == params->spark_delay_us + params->spark_pulse_us)
|
||||||
{
|
{
|
||||||
//xTaskNotifyFromISR(task, ~SPARK_A34, eSetValueWithOverwrite, &xHigherPriorityTaskWoken);
|
// xTaskNotifyFromISR(task, ~SPARK_A34, eSetValueWithOverwrite, &xHigherPriorityTaskWoken);
|
||||||
digitalWrite(SPARK_A34, LOW);
|
digitalWrite(SPARK_A34, LOW);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (params->state_time >= params->pause_short_us)
|
if (params->state_time >= params->pause_short_us)
|
||||||
{
|
{
|
||||||
@@ -120,14 +141,29 @@ void onTimer(void *arg)
|
|||||||
case S_34N:
|
case S_34N:
|
||||||
if (params->state_time == params->clock_period_us && !params->coil34n_high)
|
if (params->state_time == params->clock_period_us && !params->coil34n_high)
|
||||||
{
|
{
|
||||||
//xTaskNotifyFromISR(task, PIN_TRIG_A34N, eSetValueWithOverwrite, &xHigherPriorityTaskWoken);
|
// xTaskNotifyFromISR(task, PIN_TRIG_A34N, eSetValueWithOverwrite, &xHigherPriorityTaskWoken);
|
||||||
digitalWrite(PIN_TRIG_A34N, HIGH);
|
digitalWrite(PIN_TRIG_A34N, HIGH);
|
||||||
params->coil34n_high = true;
|
params->coil34n_high = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (params->soft_start)
|
||||||
|
{
|
||||||
|
if (params->state_time == params->spark_delay_us)
|
||||||
|
{
|
||||||
|
// xTaskNotifyFromISR(task, SPARK_A34, eSetValueWithOverwrite, &xHigherPriorityTaskWoken);
|
||||||
|
digitalWrite(SPARK_A34, HIGH);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (params->state_time == params->spark_delay_us + params->spark_pulse_us)
|
||||||
|
{
|
||||||
|
// xTaskNotifyFromISR(task, ~SPARK_A34, eSetValueWithOverwrite, &xHigherPriorityTaskWoken);
|
||||||
|
digitalWrite(SPARK_A34, LOW);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (params->state_time >= params->coil_pulse_us && params->coil34n_high)
|
if (params->state_time >= params->coil_pulse_us && params->coil34n_high)
|
||||||
{
|
{
|
||||||
//xTaskNotifyFromISR(task, ~PIN_TRIG_A34N, eSetValueWithOverwrite, &xHigherPriorityTaskWoken);
|
// xTaskNotifyFromISR(task, ~PIN_TRIG_A34N, eSetValueWithOverwrite, &xHigherPriorityTaskWoken);
|
||||||
digitalWrite(PIN_TRIG_A34N, LOW);
|
digitalWrite(PIN_TRIG_A34N, LOW);
|
||||||
params->coil34n_high = false;
|
params->coil34n_high = false;
|
||||||
params->state = S_WAIT_10MS_END;
|
params->state = S_WAIT_10MS_END;
|
||||||
@@ -138,7 +174,7 @@ void onTimer(void *arg)
|
|||||||
case S_WAIT_10MS_END:
|
case S_WAIT_10MS_END:
|
||||||
if (!wait_sent)
|
if (!wait_sent)
|
||||||
{
|
{
|
||||||
//xTaskNotifyFromISR(task, S_WAIT_10MS_END, eSetValueWithOverwrite, &xHigherPriorityTaskWoken);
|
// xTaskNotifyFromISR(task, S_WAIT_10MS_END, eSetValueWithOverwrite, &xHigherPriorityTaskWoken);
|
||||||
wait_sent = true;
|
wait_sent = true;
|
||||||
}
|
}
|
||||||
if (params->state_time >= params->pause_long_us)
|
if (params->state_time >= params->pause_long_us)
|
||||||
|
|||||||
Reference in New Issue
Block a user