Skip to content

Commit

Permalink
Added GET TEST command (#213)
Browse files Browse the repository at this point in the history
  • Loading branch information
Eirenliel authored Dec 25, 2022
1 parent a4466ed commit 92ded06
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/GlobalVars.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@
#include "LEDManager.h"
#include "status/StatusManager.h"
#include "configuration/Configuration.h"
#include "sensors/SensorManager.h"

extern SlimeVR::LEDManager ledManager;
extern SlimeVR::Status::StatusManager statusManager;
extern SlimeVR::Configuration::Configuration configuration;
extern SlimeVR::Sensors::SensorManager sensorManager;

#endif
4 changes: 2 additions & 2 deletions src/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
// Not recommended for production
#define ENABLE_INSPECTION false

#define FIRMWARE_BUILD_NUMBER 13
#define FIRMWARE_VERSION "0.3.0"
#define FIRMWARE_BUILD_NUMBER 14
#define FIRMWARE_VERSION "0.3.1"

#endif // SLIMEVR_DEBUG_H_
2 changes: 1 addition & 1 deletion src/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#define IMU IMU_BNO085
#define SECOND_IMU IMU
#define BOARD BOARD_SLIMEVR
#define IMU_ROTATION DEG_90
#define IMU_ROTATION DEG_270
#define SECOND_IMU_ROTATION DEG_270

// Battery monitoring options (comment to disable):
Expand Down
1 change: 1 addition & 0 deletions src/sensors/sensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class Sensor
return sensorType;
};

bool hadData = false;
protected:
uint8_t addr = 0;
uint8_t sensorId = 0;
Expand Down
33 changes: 32 additions & 1 deletion src/serial/serialcommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,16 @@ namespace SerialCommands {
FIRMWARE_VERSION,
WiFiNetwork::getAddress().toString().c_str()
);
// TODO Print sensors number and types
Sensor* sensor1 = sensorManager.getFirst();
Sensor* sensor2 = sensorManager.getSecond();
logger.info(
"Sensor 1: %s",
getIMUNameByType(sensor1->getSensorType())
);
logger.info(
"Sensor 2: %s",
getIMUNameByType(sensor2->getSensorType())
);
}

if (parser->equalCmdParam(1, "CONFIG")) {
Expand Down Expand Up @@ -109,6 +118,27 @@ namespace SerialCommands {
LED_INVERTED
);
}

if (parser->equalCmdParam(1, "TEST")) {
logger.info(
"[TEST]Board: %d, hardware: %d, build: %d, firmware: %s, mac: %s",
BOARD,
HARDWARE_MCU,
FIRMWARE_BUILD_NUMBER,
FIRMWARE_VERSION,
WiFi.macAddress()
);
Sensor* sensor1 = sensorManager.getFirst();
logger.info(
"[TEST] Sensor 1: %s",
getIMUNameByType(sensor1->getSensorType())
);
if(!sensor1->hadData) {
logger.error("[TEST] Sensor 1 didn't send any data yet!");
} else {
logger.info("[TEST] Sensor 1 sent some data, looks working.");
}
}
}

void cmdReport(CmdParser * parser) {
Expand Down Expand Up @@ -151,6 +181,7 @@ namespace SerialCommands {
cmdCallbacks.addCmd("FRST", &cmdFactoryReset);
cmdCallbacks.addCmd("REP", &cmdReport);
cmdCallbacks.addCmd("REBOOT", &cmdReboot);

}

void update() {
Expand Down

0 comments on commit 92ded06

Please sign in to comment.