todos and i2c scanner modified
This commit is contained in:
Vendored
+2
@@ -87,6 +87,8 @@
|
||||
"Keine",
|
||||
"kleiax",
|
||||
"Lebennig",
|
||||
"pidl",
|
||||
"pidr",
|
||||
"Punica",
|
||||
"RHEDE",
|
||||
"TPMOBIL",
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
-> Document the Akku lib
|
||||
-> Document the battery pack lib
|
||||
-> Program underfloorLighting
|
||||
-> Program battery pack tracking
|
||||
|
||||
|
||||
+16
-16
@@ -46,7 +46,6 @@ DebugMqtt* debugMqtt;
|
||||
void callbackControllerAction(void);
|
||||
void callbackControllerConnect(void);
|
||||
void i2cScanner(void);
|
||||
void restart(void);
|
||||
void makeMenu(void);
|
||||
|
||||
|
||||
@@ -65,7 +64,7 @@ void setup() {
|
||||
std::cout.rdbuf(bufMqtt);
|
||||
|
||||
std::cout << "Welcome to Kleiax-Rover" << std::endl;
|
||||
std::cout << "All actions from the main programm run on Core -> " << xPortGetCoreID() << std::endl;
|
||||
std::cout << "All actions from the main program run on Core -> " << xPortGetCoreID() << std::endl;
|
||||
|
||||
Ps3.attach(callbackControllerAction);
|
||||
Ps3.attachOnConnect(callbackControllerConnect);
|
||||
@@ -130,7 +129,8 @@ void callbackControllerConnect() {
|
||||
std::cout << "Controller connected to ESP32" << std::endl;
|
||||
std::cout << "All actions from the Controller run on Core -> " << xPortGetCoreID() << std::endl;
|
||||
|
||||
// TODO: Display is not functional without this seconde init, first init is in setup()
|
||||
// Display is not functional without this seconde init, first init is in setup(),
|
||||
// because after the setup the other core control the display.
|
||||
lcd->init();
|
||||
main_m->printMenu();
|
||||
}
|
||||
@@ -140,33 +140,29 @@ void i2cScanner() {
|
||||
|
||||
byte error, address;
|
||||
int nDevices;
|
||||
Serial.println("Scanning...");
|
||||
std::cout << "Scanning..." << std::endl;
|
||||
nDevices = 0;
|
||||
for(address = 1; address < 127; address++ ) {
|
||||
Wire.beginTransmission(address);
|
||||
error = Wire.endTransmission();
|
||||
if (error == 0) {
|
||||
Serial.print("I2C device found at address 0x");
|
||||
std::cout << "I2C device found at address 0x";
|
||||
if (address<16)
|
||||
Serial.print("0");
|
||||
Serial.println(address,HEX);
|
||||
std::cout << "0";
|
||||
std::cout << std::hex << address << std::endl;
|
||||
nDevices++;
|
||||
}
|
||||
else if (error==4) {
|
||||
Serial.print("Unknow error at address 0x");
|
||||
std::cout << "Unknow error at address 0x";
|
||||
if (address<16)
|
||||
Serial.print("0");
|
||||
Serial.println(address,HEX);
|
||||
std::cout << "0";
|
||||
std::cout << std::hex << address << std::endl;
|
||||
}
|
||||
}
|
||||
if (nDevices == 0)
|
||||
Serial.println("No I2C devices found\n");
|
||||
std::cout << "No I2C devices found\n" << std::endl;
|
||||
else
|
||||
Serial.println("done\n");
|
||||
}
|
||||
|
||||
void restart() {
|
||||
ESP.restart();
|
||||
std::cout << "done\n" << std::endl;
|
||||
}
|
||||
|
||||
void makeMenu() {
|
||||
@@ -174,6 +170,10 @@ void makeMenu() {
|
||||
std::cout << "Dummy in Action" <<std::endl;
|
||||
};
|
||||
|
||||
auto restart = []() {
|
||||
ESP.restart();
|
||||
};
|
||||
|
||||
// Create Menu
|
||||
main_m = new Menu();
|
||||
Menu* mode_m = new Menu();
|
||||
|
||||
Reference in New Issue
Block a user