speeduino/test/test_decoders/test_decoders.cpp

40 lines
783 B
C++
Raw Normal View History

2020-11-19 02:38:00 -08:00
#include <Arduino.h>
2022-05-24 18:02:55 -07:00
#include <globals.h>
#include <unity.h>
2020-11-19 02:38:00 -08:00
#include "missing_tooth/missing_tooth.h"
#include "dual_wheel/dual_wheel.h"
Renix 44 tooth decoder (includes 66 tooth code) (#1037) * Renix 44-2-2 & 66-2-2-2 initial version coded, not tested yet, saving to secure code * First working version on ardustim * updates to trigger setup * latest changes * 66 tooth working but occasional short dwell * staging before major rewrite updating the primary trigger to look for 12th system tooth to increment toothCurrentCount after this checking * updated working but with bad dwell/timing code works but the timing and dwell are not accurate once rpm goes over 400rpm * Renix code 1st release updated code to do both 44 and 66 tooth within a single set of functions * remove support for sequential for 44 tooth Sequential (via cam) was added for 44 tooth to enable future expansion. This is interfering with the normal code on the first testers car. * updated cam position * remove Dev logging * remove logging * updates to trigger decoding fixes to 66 tooth pattern and removal of secondary flag for 44 tooth decoder * fixes to decoder - rpm double * updates to support display cam tooth position added code to display which teeth the cam tooth arrives on as VVT1 & 2 and as Aux0 and Aux1. * Revert "updates to support display cam tooth position" This reverts commit d2ace89ea7495a6bf811af823d7f015189306340. * fixes from update to latest speeduino firmware * Add 4cyl semi-seq injector pairing option * Add timestamp field to SD logs * Fix soft and hard rev limiter (#813) * Increase dwell limiter in RX-8 type ignition (#820) Currently the dwell limiter calculation considers rotary ignition to have more than 1 pulse per revolution. This only holds true for FC/FD type ignition which is wasted spark correctly resulting in 2 pulses per revolution. RX-8 type ignition however is fully sequential so there is only 1 pulse per revolution. As a result the dwell limiter is being calculated too low. This change fixes the issue by correctly assuming 1 pulse per revolution in RX-8 type ignition * All tapers use byte counters (#746) Fixes Update idle.ino * Correct variable size for MAPlast * Fix issue with SD RPM threshold not correctly detecting on/off * Reorganise Engine Protection UI * Add low/high battery voltage indicator (#824) Fixes #822 * Remove tacho output flags (#814) * fix typos in code documentation (#816) * fix typos in code documentation * minor reverts * fix typos in ini Co-authored-by: Josh Stewart <josh@noisymime.org> * Added Trigger for the Yamaha Vmax motorcycle, 1990 and up. (#823) * Test 1 * Added the Vmax decoder option * Added the Yamaha Vmax decoder Co-authored-by: RempageR1 <unconfigured@null.spigotmc.org> Co-authored-by: Josh Stewart <josh@noisymime.org> * Allow for '?' command through legacy comms. Fixes #821 * Added idle advance start threshold (#747) * Added idle advance start threshold On lower temp and/or on ethanol the engine need to crank more, without this my starter get a kick and the engine backfires. This enable it only at 200 RPM below the target * Use define to idle advance RPM threshold Co-authored-by: Josh Stewart <josh@noisymime.org> * Remove previousLoopTime - never used (#706) * Simplify the corrections calculations using div100 * Fix the calculations dash figures when battery correction is applied to open time only * PWM and on/off idle fixes/cleanup (#806) * Idle fixes #1 * Idle fixes #2 Co-authored-by: Josh Stewart <josh@noisymime.org> * Remove duplicate iacClosedLoopTable. Lookup idle target RPM @ 4Hz after CLT reading * Fix validTrigger assignment in Vmax decoder * Align TPS_rateOfChange scale. Potential fix for #773 * Enable semi sequential and wasted COP on half sync (#478) * Semi/Full sequential mode Semi sequential in case of absent phase input at crank, engine will almost aways start in semi sequential mode Minimal code change at speeduino.ino Fix RPM reading when in half sync * Update with latest changes in master * Less calls to change functions See #478 chat history for details * Semi/Full sequential mode Semi sequential in case of absent phase input at crank, engine will almost aways start in semi sequential mode Minimal code change at speeduino.ino Fix RPM reading when in half sync * Update with latest changes in master * Less calls to change functions See #478 chat history for details * Add sync status to log * Updates Updated speeduino.ini Updated updates.ino * Fix error in half to full sync function Co-authored-by: Josh Stewart <josh@noisymime.org> * Fixes after merge with speeduino master * improved debug on sync loss using VVTangle * additional debug uses aux channels for debug eg currentStatus.canin[2] these need removing from the full version. Also uses VVT1 pin for debug via VVT1_PIN_OFF() and VVT1_PIN_ON() * fixes * remove secondary trigger * different logging * Final Version * added automated tests * fixed fuel pump always being on * fix build issues after merge with master * Change how 44 or 66 tooth selected Updated to work out 44 or 66 tooth decoder based on the number of cylinders, 4 cylinder = 44 tooth, 6 cylinder = 66 tooth * Fix typo in ini * Delete compile_commands.json * Remove duplicate declarations * Remove VVT code from other PR * fix speeduino.ino Remove unintended additions to speeduino.ino --------- Co-authored-by: Josh Stewart <josh@noisymime.org> Co-authored-by: Pasi Kemppainen <48950874+pazi88@users.noreply.github.com> Co-authored-by: theKraid <37898397+theKraid@users.noreply.github.com> Co-authored-by: Vitor Moreno B. Sales <vitor_boss@yahoo.com.br> Co-authored-by: Corey-Harding <91717711+Corey-Harding@users.noreply.github.com> Co-authored-by: Daniel Tobias <dantob@users.noreply.github.com> Co-authored-by: RempageR1 <103254506+RempageR1@users.noreply.github.com> Co-authored-by: RempageR1 <unconfigured@null.spigotmc.org> Co-authored-by: tx_haggis <13982343+adbancroft@users.noreply.github.com> Co-authored-by: Vitor Moreno B. Sales <vitor.m.benevides@outlook.com>
2023-04-30 01:30:34 -07:00
#include "renix/renix.h"
#include "Nissan360/Nissan360.h"
#include "FordST170/FordST170.h"
#include "NGC/test_ngc.h"
void setup()
{
pinMode(LED_BUILTIN, OUTPUT);
// NOTE!!! Wait for >2 secs
// if board doesn't support software reset via Serial.DTR/RTS
delay(2000);
UNITY_BEGIN(); // IMPORTANT LINE!
2020-11-19 02:38:00 -08:00
testMissingTooth();
testDualWheel();
Renix 44 tooth decoder (includes 66 tooth code) (#1037) * Renix 44-2-2 & 66-2-2-2 initial version coded, not tested yet, saving to secure code * First working version on ardustim * updates to trigger setup * latest changes * 66 tooth working but occasional short dwell * staging before major rewrite updating the primary trigger to look for 12th system tooth to increment toothCurrentCount after this checking * updated working but with bad dwell/timing code works but the timing and dwell are not accurate once rpm goes over 400rpm * Renix code 1st release updated code to do both 44 and 66 tooth within a single set of functions * remove support for sequential for 44 tooth Sequential (via cam) was added for 44 tooth to enable future expansion. This is interfering with the normal code on the first testers car. * updated cam position * remove Dev logging * remove logging * updates to trigger decoding fixes to 66 tooth pattern and removal of secondary flag for 44 tooth decoder * fixes to decoder - rpm double * updates to support display cam tooth position added code to display which teeth the cam tooth arrives on as VVT1 & 2 and as Aux0 and Aux1. * Revert "updates to support display cam tooth position" This reverts commit d2ace89ea7495a6bf811af823d7f015189306340. * fixes from update to latest speeduino firmware * Add 4cyl semi-seq injector pairing option * Add timestamp field to SD logs * Fix soft and hard rev limiter (#813) * Increase dwell limiter in RX-8 type ignition (#820) Currently the dwell limiter calculation considers rotary ignition to have more than 1 pulse per revolution. This only holds true for FC/FD type ignition which is wasted spark correctly resulting in 2 pulses per revolution. RX-8 type ignition however is fully sequential so there is only 1 pulse per revolution. As a result the dwell limiter is being calculated too low. This change fixes the issue by correctly assuming 1 pulse per revolution in RX-8 type ignition * All tapers use byte counters (#746) Fixes Update idle.ino * Correct variable size for MAPlast * Fix issue with SD RPM threshold not correctly detecting on/off * Reorganise Engine Protection UI * Add low/high battery voltage indicator (#824) Fixes #822 * Remove tacho output flags (#814) * fix typos in code documentation (#816) * fix typos in code documentation * minor reverts * fix typos in ini Co-authored-by: Josh Stewart <josh@noisymime.org> * Added Trigger for the Yamaha Vmax motorcycle, 1990 and up. (#823) * Test 1 * Added the Vmax decoder option * Added the Yamaha Vmax decoder Co-authored-by: RempageR1 <unconfigured@null.spigotmc.org> Co-authored-by: Josh Stewart <josh@noisymime.org> * Allow for '?' command through legacy comms. Fixes #821 * Added idle advance start threshold (#747) * Added idle advance start threshold On lower temp and/or on ethanol the engine need to crank more, without this my starter get a kick and the engine backfires. This enable it only at 200 RPM below the target * Use define to idle advance RPM threshold Co-authored-by: Josh Stewart <josh@noisymime.org> * Remove previousLoopTime - never used (#706) * Simplify the corrections calculations using div100 * Fix the calculations dash figures when battery correction is applied to open time only * PWM and on/off idle fixes/cleanup (#806) * Idle fixes #1 * Idle fixes #2 Co-authored-by: Josh Stewart <josh@noisymime.org> * Remove duplicate iacClosedLoopTable. Lookup idle target RPM @ 4Hz after CLT reading * Fix validTrigger assignment in Vmax decoder * Align TPS_rateOfChange scale. Potential fix for #773 * Enable semi sequential and wasted COP on half sync (#478) * Semi/Full sequential mode Semi sequential in case of absent phase input at crank, engine will almost aways start in semi sequential mode Minimal code change at speeduino.ino Fix RPM reading when in half sync * Update with latest changes in master * Less calls to change functions See #478 chat history for details * Semi/Full sequential mode Semi sequential in case of absent phase input at crank, engine will almost aways start in semi sequential mode Minimal code change at speeduino.ino Fix RPM reading when in half sync * Update with latest changes in master * Less calls to change functions See #478 chat history for details * Add sync status to log * Updates Updated speeduino.ini Updated updates.ino * Fix error in half to full sync function Co-authored-by: Josh Stewart <josh@noisymime.org> * Fixes after merge with speeduino master * improved debug on sync loss using VVTangle * additional debug uses aux channels for debug eg currentStatus.canin[2] these need removing from the full version. Also uses VVT1 pin for debug via VVT1_PIN_OFF() and VVT1_PIN_ON() * fixes * remove secondary trigger * different logging * Final Version * added automated tests * fixed fuel pump always being on * fix build issues after merge with master * Change how 44 or 66 tooth selected Updated to work out 44 or 66 tooth decoder based on the number of cylinders, 4 cylinder = 44 tooth, 6 cylinder = 66 tooth * Fix typo in ini * Delete compile_commands.json * Remove duplicate declarations * Remove VVT code from other PR * fix speeduino.ino Remove unintended additions to speeduino.ino --------- Co-authored-by: Josh Stewart <josh@noisymime.org> Co-authored-by: Pasi Kemppainen <48950874+pazi88@users.noreply.github.com> Co-authored-by: theKraid <37898397+theKraid@users.noreply.github.com> Co-authored-by: Vitor Moreno B. Sales <vitor_boss@yahoo.com.br> Co-authored-by: Corey-Harding <91717711+Corey-Harding@users.noreply.github.com> Co-authored-by: Daniel Tobias <dantob@users.noreply.github.com> Co-authored-by: RempageR1 <103254506+RempageR1@users.noreply.github.com> Co-authored-by: RempageR1 <unconfigured@null.spigotmc.org> Co-authored-by: tx_haggis <13982343+adbancroft@users.noreply.github.com> Co-authored-by: Vitor Moreno B. Sales <vitor.m.benevides@outlook.com>
2023-04-30 01:30:34 -07:00
testRenix();
testNissan360();
testFordST170();
testNGC();
UNITY_END(); // stop unit testing
}
void loop()
{
// Blink to indicate end of test
digitalWrite(LED_BUILTIN, HIGH);
delay(250);
digitalWrite(LED_BUILTIN, LOW);
delay(250);
}