I'm using the IDE 2.1.0 with a SAMD21G board. My program seems to be working correctly and I am in the process of tweaking the error handling and display.
With some simple changes I am getting a compiler warning. I realize it's only a warning but for the life of me I can't see what the compiler see to flag a warning.
Can anyone see what I may be missing?
Thanks
function
void init_TypeK(void)
{
// doesn't really initialize, simply reads the error bit
bool error = false; <<======================= line 411
int16_t gRawData = 0;
//digitalWrite(TC_CSn, LOW);
//delayMicroseconds(10); // spec is 1µs
digitalWrite(TC_CSn, HIGH);
//delay(1);
// read the MSB only (i.e. D31 - D16)
SPI.beginTransaction(SPISettings(1000000, MSBFIRST, SPI_MODE0)); // ??? see .h line35
digitalWrite(TC_CSn, LOW); //set CS low to read SPI interface
gRawData = SPI.transfer16(0x0000); // TypeK is read only, doesn't matter what is sent in SPI.transfer16(0x000)
digitalWrite(TC_CSn, HIGH); // deselect
SPI.endTransaction();
if (gRawData & 0b0001){
error = true; <<-------------------------- where used
} // in the MSB, the fault bit (D16) is available
}
Compiler warning:
C:\Users\john\Documents\Arduino\BoilerLoggingApp\BoilerLoggingApp.ino: In function 'void init_TypeK()':
C:\Users\john\Documents\Arduino\BoilerLoggingApp\BoilerLoggingApp.ino:411:9: warning: variable 'error' set but not used [-Wunused-but-set-variable]
bool error = false;
^~~~~
Sketch uses 34800 bytes (13%) of program storage space. Maximum is 262144 bytes.
Global variables use 4548 bytes (13%) of dynamic memory, leaving 28220 bytes for local variables. Maximum is 32768 bytes.