|
116 | 116 | #include "LongUnion.h"
|
117 | 117 |
|
118 | 118 | #define LCD_I2C_ADDRESS 0x27 // Default LCD address is 0x27 for a 20 chars and 4 line / 2004 display
|
119 |
| -#include "LiquidCrystal_I2C.h" // Use an up to date library version which has the init method |
| 119 | +#include "LiquidCrystal_I2C.hpp" // Include source! Use only the modified version delivered with this program. |
120 | 120 | LiquidCrystal_I2C myLCD(LCD_I2C_ADDRESS, 20, 4);
|
121 | 121 | void printBigNumber4(byte digit, byte leftAdjust);
|
122 | 122 | void initBigNumbers();
|
@@ -662,11 +662,14 @@ public:
|
662 | 662 | AcceleratorInput.setI2CAddress(MPU6050_ADDRESS_AD0_HIGH);
|
663 | 663 | }
|
664 | 664 | // use maximum filtering. It prefers slow and huge movements :-)
|
665 |
| - |
666 | 665 | if (!AcceleratorInput.initMPU6050AndCalculateAllOffsetsAndWait(20, MPU6050_BAND_5_HZ)) {
|
667 | 666 | AcceleratorInputConnected = false;
|
668 | 667 | Serial.print(F("No MPU6050 IMU connected at address 0x"));
|
| 668 | +#if defined(USE_SOFT_I2C_MASTER) |
669 | 669 | Serial.print(AcceleratorInput.I2CAddress >> 1, HEX);
|
| 670 | +#else |
| 671 | + Serial.print(AcceleratorInput.I2CAddress, HEX); |
| 672 | +#endif |
670 | 673 | Serial.print(F(" for car "));
|
671 | 674 | Serial.print(aNumberOfThisCar);
|
672 | 675 | Serial.println(F(". You may want to disable \"#define ENABLE_ACCELERATOR_INPUT\""));
|
@@ -1541,6 +1544,20 @@ void checkForLCDConnected() {
|
1541 | 1544 | sSerialLCDAvailable = true;
|
1542 | 1545 | }
|
1543 | 1546 | i2c_stop();
|
| 1547 | +#elif defined(USE_SOFT_WIRE) |
| 1548 | +#warning SoftWire does not support dynamically check of connection because it has no setWireTimeout() function. You should use "#define USE_SOFT_I2C_MASTER" instead. |
| 1549 | +#else |
| 1550 | + Wire.setWireTimeout(); // Sets default timeout of 25 ms. |
| 1551 | + Wire.beginTransmission(LCD_I2C_ADDRESS); |
| 1552 | + if (Wire.endTransmission(true) != 0) { |
| 1553 | + if (!sOnlyPlotterOutput) { |
| 1554 | + Serial.println(F("No I2C LCD connected at address " STR(LCD_I2C_ADDRESS))); |
| 1555 | + } |
| 1556 | + playError(); |
| 1557 | + sSerialLCDAvailable = false; |
| 1558 | + } else { |
| 1559 | + sSerialLCDAvailable = true; |
| 1560 | + } |
1544 | 1561 | #endif
|
1545 | 1562 | }
|
1546 | 1563 |
|
|
0 commit comments