Update Payload_BME280_MPU6050_XS.ino switch between calibration points

beta-cal
Alan Johnston 2 years ago committed by GitHub
parent c776306078
commit 42f95fde86
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -37,6 +37,8 @@ int blueLED = 8;
int Sensor1 = 0; int Sensor1 = 0;
float Sensor2 = 0; float Sensor2 = 0;
float temp; float temp;
int calibration = 0;
void ee_prom_word_write(int addr, int val); void ee_prom_word_write(int addr, int val);
short ee_prom_word_read(int addr); short ee_prom_word_read(int addr);
int first_time = true; int first_time = true;
@ -375,20 +377,24 @@ void loop() {
setup(); setup();
} }
else if (result == 'S') { else if (result == 'S') {
Serial.println("Storing temperature calibration data point in EEPROM\n"); Serial.print("Storing temperature calibration data point "); // in EEPROM\n");
Serial.print(calibration + 1);
Serial.print(" in EEPROM\n");
Serial.println(temp); Serial.println(temp);
Serial.println(sensorValue); Serial.println(sensorValue);
Serial.println(" "); Serial.println(" ");
eeprom_word_write(6, (int)(temp * 10.0) + 0.5); eeprom_word_write(calibration * 2 + 4 , (int)(temp * 10.0) + 0.5);
eeprom_word_write(7, sensorValue); eeprom_word_write(calibration * 2 + 5, sensorValue);
calibration = (calibration++) % 1
if (EEPROM.commit()) { if (EEPROM.commit()) {
Serial.println("EEPROM successfully committed"); Serial.println("EEPROM successfully committed");
} else { } else {
Serial.println("ERROR! EEPROM commit failed"); Serial.println("ERROR! EEPROM commit failed");
} }
} }
//#endif //#endif

Loading…
Cancel
Save

Powered by TurnKey Linux.