So I was wondering why I am getting the following error:
Error 1 undefined reference to `MIN_COUNTER' C:\Users\Wyatt Crosby\Dropbox\Atmel Studio\ReflowController\ReflowController\ReflowController\Debug/.././ReflowController.c 146 1 ReflowController
When in PID.h I have:
#ifndef PID_H
#define PID_H
#define LCD_SCREEN_SIZE 16
#define MAX_COUNTS 180
#define OVEN_MAX_TEMP 260
#define OVEN_MIN_TEMP 0
#define MIN_COUNTER(x,a) tempLookupArray[x] < a ? x : MIN_COUNTER(x+1,a)
#define FIND_COUNTER(a) a <= OVEN_MIN_TEMP ? MAX_COUNTS : MIN_COUNTER(0,a)
const float tempLookupArray[MAX_COUNTS];
...
Where tempLookupArray is define further in PID.c:
const float tempLookupArray[MAX_COUNTS] = {
260.00,
260.00,
260.00,
259.99,
259.98,
259.96,
...
And in ReflowController.c I include PID.h and write:
TriggerCounter = FIND_COUNTER(PIDgain);
Where PIDgain is local and of type 'float', and TriggerCounter is global and of type 'volatile int'
It seems to be the fact that I am trying to call MIN_COUNTER from inside MIN_COUNTER and doesn't have any sort of prototype for it yet (if it were a function) . . .
Any thoughts from you smart guys out there?
Thanks!