The goal is to let end user put type in a formula string. Anything that fits the bounds of the parser. Nothing big. Formulas for converting incoming data from a GM OBD2 PCM on the fly.
Calculate RPM, MPH, Coolant temps, Current Gear, Knock, ect...

IIRC >> @el_supremo noted on the linked Arduino page that 'printf' needs to be replaced with Serial.printf()

Yah makes total since. printf by itself, i guess has no where to go on output.

Renamed it from .C file to .CPP

Added Arduino.h so can have access to Serial and changed those to Serial.printf and now they output fine.

So now this seems to work well!

Even have my << >> for shifting added and those work too!

Thanks for being available to bounce this off of.

I am A Pascal/Delphi developer for A living. Also been using Pascal pretty much for past 30 years. So once it comes to using C, sometimes the obvious right in front of my face isn't so obvious.

So pretty much in general, rename file, add 1 line, change 2 lines, and now its Arduino compatible.

FYI, that crashreport was from the last crash that happened. No more crash reports after turning it off and back on.

Good work - glad to help - Any feedback on the speed?

Yes, persistent CrashReport is recorded until removed by reading or power loss.

Tip: Use BING search
> Just selected text " formula expression parsing" and right click search and added 'Arduino' in front and that brought p#2 links to top search result.

Nice you made sense of the c>>cpp and Arduino world. IDE may be despicable and cringe worthy by some standards ... but it is a low barrier common denominator : easy to install and use.

Good work - glad to help - Any feedback on the speed?

Yes, persistent CrashReport is recorded until removed by reading or power loss.

Tip: Use BING search
> Just selected text " formula expression parsing" and right click search and added 'Arduino' in front and that brought p#2 links to top search result.

Nice you made sense of the c>>cpp and Arduino world. IDE may be despicable and cringe worthy by some standards ... but it is a low barrier common denominator : easy to install and use.

Speed wise seems very good. Thinking of adding a 2nd sketch showing A number of the simple formulas of mine running one after another and timing it.

I should use BING more. Use it from time to time. As I literally did "Arduino formula expression parsing" on Google. And its mostly stack over flow fart sniffers or Arduno.cc forum of people in A tizzy.

.... C / C++ in general and the Arduino IDE spin on things is A head spinner for me that is for sure. Since C / C++ not my thing to begin with.

No search is perfect ... too much out there ... and needing just the right context words. Since g00gle is despicable BING is the default here.

Odd the TOP result was that from a 2015 thread ... and odder still it was the perfect answer!

The 600 MHz 1062 on the T_4.1 with Double FPU should be fast and give good results. Significantly faster than any AVR or even lesser 32 bit ARM's with 512KB of full speed RAM for CODE and DATA and bumps of dual instruction execution when possible.

The IDE does dynamic 'make' inclusion (and some hand holding prototyping in INO file) - just needs some tips in the code presented (INO's get Arduino.h and .cpp's don't - as you found) - then it just uses standard 'gcc' build process for c/cpp code into executable.

Using fixed variable values... 16,32,64,128,256 to fill in variables of N0, N1, N2, N3, N4
So data not real. But It looks good.

Start
Formula for ENGINE SPEED
Original Formula : ((N1 << 8) +N2) *0.25
Variables filled in Formula : ((16 << 8) +16) *0.25
Result = 1028.00
-----------------------------------------
Formula for Injector PW
Original Formula : (((N1<<8)+N2)/65.535)
Variables filled in Formula : (((16<<8)+16)/65.535)
Result = 62.75
-----------------------------------------
Formula for ECT (ENGINE COOLANT TEMPERATURE)
Original Formula : N0-40
Variables filled in Formula : 16-40
Result = -24.00
-----------------------------------------
Formula for MASS AIR FLOW RAW INPUT FREQUENCY
Original Formula : ((N1 << 8) + N2) / 2.048
Variables filled in Formula : ((16 << 8) + 16) / 2.048
Result = 2007.81
-----------------------------------------
Formula for SHORT TERM FUEL TRIM BANK 1
Original Formula : (N0-128)/1.28
Variables filled in Formula : (16-128)/1.28
Result = -87.50
-----------------------------------------
Formula for LONG TERM FUEL TRIM BANK 1
Original Formula : (N0-128)/1.28
Variables filled in Formula : (16-128)/1.28
Result = -87.50
-----------------------------------------
Formula for MAP (kPa)
Original Formula : N0
Variables filled in Formula : 16
Result = 16.00
-----------------------------------------
Formula for VEHICLE SPEED
Original Formula : N0/1.609
Variables filled in Formula : 16/1.609
Result = 9.94
-----------------------------------------
Formula for SPARK ADVANCE
Original Formula : ((N0/2) - 64)
Variables filled in Formula : ((16/2) - 64)
Result = -56.00
-----------------------------------------
Formula for INTAKE AIR TEMPERATURE
Original Formula : N0-40
Variables filled in Formula : 16-40
Result = -24.00
-----------------------------------------
Formula for TP Angle %
Original Formula : N0/2.55
Variables filled in Formula : 16/2.55
Result = 6.27
-----------------------------------------
Formula for Ignition 1 Voltage
Original Formula : N0/10
Variables filled in Formula : 16/10
Result = 1.60
-----------------------------------------
Formula for H02S Sensor 1
Original Formula : 0.434*N0*10
Variables filled in Formula : 0.434*16*10
Result = 69.44
-----------------------------------------
Formula for Knock Retard
Original Formula : 22.5*N0/256
Variables filled in Formula : 22.5*16/256
Result = 1.41
-----------------------------------------
Formula for Current Gear
Original Formula : N0
Variables filled in Formula : 16
Result = 16.00
-----------------------------------------
Formula for Misfire Cyl. 1 History
Original Formula : (N1 << 8) + N2
Variables filled in Formula : (16 << 8) + 16
Result = 4112.00
-----------------------------------------
Formula for Misfire Cyl. 1 Current
Original Formula : N0
Variables filled in Formula : 16
Result = 16.00
-----------------------------------------
Formula for Misfire Cyl. 2 History
Original Formula : (N1 << 8) + N2
Variables filled in Formula : (16 << 8) + 16
Result = 4112.00
-----------------------------------------
Formula for Misfire Cyl. 2 Current
Original Formula : N0
Variables filled in Formula : 16
Result = 16.00
-----------------------------------------
Formula for Misfire Cyl. 3 History
Original Formula : (N1 << 8) + N2
Variables filled in Formula : (16 << 8) + 16
Result = 4112.00
-----------------------------------------
Formula for Misfire Cyl. 3 Current
Original Formula : N0
Variables filled in Formula : 16
Result = 16.00
-----------------------------------------
Formula for Misfire Cyl. 4 History
Original Formula : (N1 << 8) + N2
Variables filled in Formula : (16 << 8) + 16
Result = 4112.00
-----------------------------------------
Formula for Misfire Cyl. 4 Current
Original Formula : N0
Variables filled in Formula : 16
Result = 16.00
-----------------------------------------
Formula for Misfire Cyl. 5 History
Original Formula : (N1 << 8) + N2
Variables filled in Formula : (16 << 8) + 16
Result = 4112.00
-----------------------------------------
Formula for Misfire Cyl. 5 Current
Original Formula : N0
Variables filled in Formula : 16
Result = 16.00
-----------------------------------------
Formula for Misfire Cyl. 6 History
Original Formula : (N1 << 8) + N2
Variables filled in Formula : (16 << 8) + 16
Result = 4112.00
-----------------------------------------
Formula for Misfire Cyl. 6 Current
Original Formula : N0
Variables filled in Formula : 16
Result = 16.00
-----------------------------------------
Formula for Fuel Trim Cell
Original Formula : N0
Variables filled in Formula : 16
Result = 16.00
-----------------------------------------
Formula for MAF Flow Rate
Original Formula : ((N1 << 8) + N2) / 100
Variables filled in Formula : ((16 << 8) + 16) / 100
Result = 41.12
-----------------------------------------
Formula for AFR (Commanded)
Original Formula : N0 / 10
Variables filled in Formula : 16 / 10
Result = 1.60
-----------------------------------------
Formula for Last Shift Time
Original Formula : N0 / 40
Variables filled in Formula : 16 / 40
Result = 0.40
-----------------------------------------
Formula for 1-2 Shift Time
Original Formula : N0 / 40
Variables filled in Formula : 16 / 40
Result = 0.40
-----------------------------------------
Formula for 2-3 Shift Time
Original Formula : N0 / 40
Variables filled in Formula : 16 / 40
Result = 0.40
-----------------------------------------
Formula for 3-4 Shift Time
Original Formula : N0 / 40
Variables filled in Formula : 16 / 40
Result = 0.40
-----------------------------------------
Formula for 1-2 Shift Error
Original Formula : N0 / 40
Variables filled in Formula : 16 / 40
Result = 0.40
-----------------------------------------
Formula for 2-3 Shift Error
Original Formula : N0 / 40
Variables filled in Formula : 16 / 40
Result = 0.40
-----------------------------------------
Formula for 3-4 Shift Error
Original Formula : N0 / 40
Variables filled in Formula : 16 / 40
Result = 0.40
-----------------------------------------
Formula for Fuel Loop Status
Original Formula : ((N0 >> 3) & 1)
Variables filled in Formula : ((16 >> 3) & 1)
Result = 0.00
-----------------------------------------
Formula for Perf Shift Mode
Original Formula : ((N0 >> 2) & 1)
Variables filled in Formula : ((16 >> 2) & 1)
Result = 0.00
-----------------------------------------
Formula for Desired Idle Speed
Original Formula : N0 * 12.5
Variables filled in Formula : 16 * 12.5
Result = 200.00
-----------------------------------------
Formula for IAC Position
Original Formula : N0
Variables filled in Formula : 16
Result = 16.00
-----------------------------------------
Formula for Power Enrichment Mode
Original Formula : ((N0 >> 2) & 1)
Variables filled in Formula : ((16 >> 2) & 1)
Result = 0.00
-----------------------------------------
Formula for Decel Fuel Mode
Original Formula : ((N0 >> 3) & 1)
Variables filled in Formula : ((16 >> 3) & 1)
Result = 0.00
-----------------------------------------
Formula for Transmission ISS
Original Formula : ((N1 << 8) + N2) * 0.125
Variables filled in Formula : ((16 << 8) + 16) * 0.125
Result = 514.00
-----------------------------------------
Formula for Transmission OSS
Original Formula : ((N1 << 8) + N2) * 0.125
Variables filled in Formula : ((16 << 8) + 16) * 0.125
Result = 514.00
-----------------------------------------
Formula for TCC Slip Speed
Original Formula : ((N1 << 8) + N2) * 0.125
Variables filled in Formula : ((16 << 8) + 16) * 0.125
Result = 514.00
-----------------------------------------
Formula for Transmission Fluid Temp
Original Formula : N0 - 40
Variables filled in Formula : 16 - 40
Result = -24.00
-----------------------------------------
Formula for TCC Duty Cycle
Original Formula : N0 / 2.55
Variables filled in Formula : 16 / 2.55
Result = 6.27
-----------------------------------------
Formula for PC Solenoid Duty Cycle
Original Formula : N0 / 2.55
Variables filled in Formula : 16 / 2.55
Result = 6.27
-----------------------------------------
Formula for PC Solenoid Actual Current
Original Formula : N0 * 0.0195
Variables filled in Formula : 16 * 0.0195
Result = 0.31
-----------------------------------------
Formula for PC Solenoid Reference Current
Original Formula : N0 * 0.0195
Variables filled in Formula : 16 * 0.0195
Result = 0.31
-----------------------------------------
Formula for 18X Crank Sensor
Original Formula : 1310720 / (((N1 << 8) + N2) * 6)
Variables filled in Formula : 1310720 / (((16 << 8) + 16) * 6)
Result = 53.13
-----------------------------------------
Formula for 3X Crank Sensor
Original Formula : 1310720 / ((N1 << 8) + N2)
Variables filled in Formula : 1310720 / ((16 << 8) + 16)
Result = 318.75
-----------------------------------------
Formula for Fans Low Speed
Original Formula : ((N0 >> 6) & 1)
Variables filled in Formula : ((16 >> 6) & 1)
Result = 0.00
-----------------------------------------
Formula for Fans High Speed
Original Formula : ((N0 >> 7) & 1)
Variables filled in Formula : ((16 >> 7) & 1)
Result = 0.00
-----------------------------------------
Formula for Gear Ratio
Original Formula : N0 * 0.01563
Variables filled in Formula : 16 * 0.01563
Result = 0.25
-----------------------------------------
Formula for SPARK ADVANCE (Alt)
Original Formula : ((-1 * N0 / 2) + 64) * -1
Variables filled in Formula : ((-1 * 16 / 2) + 64) * -1
Result = -56.00
-----------------------------------------
Formula for HO2 Bank 1 Sensor 2
Original Formula : 0.434 * N0 * 10
Variables filled in Formula : 0.434 * 16 * 10
Result = 69.44
-----------------------------------------
Formula for Traction Control Desired Torque
Original Formula : ((N1 << 8) + N2) * 5 / 256
Variables filled in Formula : ((16 << 8) + 16) * 5 / 256
Result = 80.31
-----------------------------------------
Formula for Fuel Level
Original Formula : ((N1 << 8) + N2) * 0.01953125
Variables filled in Formula : ((16 << 8) + 16) * 0.01953125
Result = 80.31
-----------------------------------------
Formula for Transmission Range Switch A
Original Formula : N0 & 1
Variables filled in Formula : 16 & 1
Result = 0.00
-----------------------------------------
Formula for Transmission Range Switch B
Original Formula : ((N0 >> 1) & 1)
Variables filled in Formula : ((16 >> 1) & 1)
Result = 0.00
-----------------------------------------
Formula for Transmission Range Switch C
Original Formula : ((N0 >> 2) & 1)
Variables filled in Formula : ((16 >> 2) & 1)
Result = 0.00
-----------------------------------------
Formula for Transmission Range Switch P
Original Formula : ((N0 >> 3) & 1)
Variables filled in Formula : ((16 >> 3) & 1)
Result = 0.00
-----------------------------------------
Formula for Transmission Range
Original Formula : N0 & 15
Variables filled in Formula : 16 & 15
Result = 0.00
-----------------------------------------
Formula for Boost Solenoid PWM
Original Formula : ((N1 > 4) & 2) + ((N2 > 5) & 3)
Variables filled in Formula : ((16 > 4) & 2) + ((16 > 5) & 3)
Result = 1.00
-----------------------------------------
Formula for Engine Torque
Original Formula : ((N1 << 8) + N2) * 0.33895
Variables filled in Formula : ((16 << 8) + 16) * 0.33895
Result = 1393.76
-----------------------------------------
Formula for EGR %
Original Formula : N0 / 2.55
Variables filled in Formula : 16 / 2.55
Result = 6.27
-----------------------------------------
Formula for EGR Duty Cycle
Original Formula : N0 / 2.55
Variables filled in Formula : 16 / 2.55
Result = 6.27
-----------------------------------------
Formula for Desired EGR %
Original Formula : N0 / 2.55
Variables filled in Formula : 16 / 2.55
Result = 6.27
-----------------------------------------
Formula for EGR Closed Valve Pintle Position
Original Formula : N0 / 51
Variables filled in Formula : 16 / 51
Result = 0.31
-----------------------------------------
Formula for EGR Flow Test Count
Original Formula : N0
Variables filled in Formula : 16
Result = 16.00
-----------------------------------------
Formula for EGR Position Error
Original Formula : (N0 - 128) / 1.28
Variables filled in Formula : (16 - 128) / 1.28
Result = -87.50
-----------------------------------------
Formula for Commanded EGR
Original Formula : N0 / 2.55
Variables filled in Formula : 16 / 2.55
Result = 6.27
-----------------------------------------
Formula for EGR Error %
Original Formula : N0 * 0.78125 - 100
Variables filled in Formula : 16 * 0.78125 - 100
Result = -87.50
-----------------------------------------
Formula for TP Sensor Voltage
Original Formula : N0 / 51
Variables filled in Formula : 16 / 51
Result = 0.31
-----------------------------------------
Formula for CMP Sensor Signal Present
Original Formula : ((N0 >> 1) & 1)
Variables filled in Formula : ((16 >> 1) & 1)
Result = 0.00
-----------------------------------------
End
elapsed : 1ms