Skip to content

Commit

Permalink
Merge branch 'fixes'
Browse files Browse the repository at this point in the history
  • Loading branch information
laurb9 committed Sep 28, 2020
2 parents 963e77a + 0b4bc9d commit 0126190
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 10 deletions.
4 changes: 3 additions & 1 deletion examples/PanoController/PanoController.ino
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "mpu.h"
#include "battery.h"
#include "gcode.h"
#include "compat.h"

#if defined(BLUEFRUIT_SPI_CS)
#include "ble_bluefruit_spi.h"
Expand All @@ -36,8 +37,9 @@ static GCode gcode(ble, motors, camera, mpu, battery);
void setup() {
Serial.begin(115200);
delay(3000); // wait for serial
Serial.println("PanoController " REVISION);
Serial.println("PanoController " GIT_VERSION);
Serial.println("On " ARDUINO_VARIANT " board " ARDUINO_BOARD);
Serial.println("Platform " PANO_PLATFORM);

// turn on power to MPU but give it time to stabilize
pinMode(MPU_VCC, OUTPUT);
Expand Down
4 changes: 0 additions & 4 deletions examples/PanoController/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
* Pano Controller Master Configuration File
*/

#if !defined(REVISION)
#define REVISION __DATE__
#endif

// Battery monitoring settings
#define VCC 3300

Expand Down
2 changes: 1 addition & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ monitor_speed = 115200
lib_deps =
laurb9/StepperDriver@^1.3.0
build_flags =
!echo "-D REVISION='\"$(git describe --long --dirty --always)\"'"
!echo "-D GIT_VERSION='\"$(git describe --long --dirty --always)\"'"
-D PLATFORM_MECHA_E1
; -D PLATFORM_PANOCONTROLLER_V4
; -D PLATFORM_GIGAPAN
Expand Down
27 changes: 27 additions & 0 deletions src/compat.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

#if !defined(GIT_VERSION)
#define GIT_VERSION __DATE__
#endif

#if !defined(ARDUINO_VARIANT)
#if defined(CORE_TEENSY)
#define ARDUINO_VARIANT "teensy"
#define ARDUINO_BOARD "teensy board"
#else
#define ARDUINO_VARIANT "undefined"
#endif
#endif

#if !defined(ARDUINO_BOARD)
#define ARDUINO_BOARD "undefined board"
#endif

#if !defined(PANO_PLATFORM)
#if defined(PLATFORM_PANOCONTROLLER_V4)
#define PANO_PLATFORM "PanoController V4"
#elif defined(PLATFORM_GIGAPAN)
#define PANO_PLATFORM "Gigapan Epic 100"
#elif defined(PLATFORM_MECHA_E1)
#define PANO_PLATFORM "Nodal Ninja MECHA E1"
#endif
#endif
10 changes: 6 additions & 4 deletions src/gcode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* A copy of this license has been included with this distribution in the file LICENSE.
*/
#include "gcode.h"
#include "compat.h"

#define d(x) serial.print(x)
#define dln(x) serial.println(x)
Expand Down Expand Up @@ -195,15 +196,16 @@ void GCode::execute(char buffer[]){
if (cmd.nonmodal & NonModal::M115){
// Firmware version, capabilities and static configuration
// These only need to be read once, at connection time.
#if !defined(REVISION)
#define REVISION 2.2
#if !defined(GIT_VERSION)
#define GIT_VERSION "2.2"
#endif
dln("Name=PanoController");
dln("Version=" REVISION);
dln("Version=" GIT_VERSION);
dln("Build=" __DATE__ " " __TIME__);
dln("Arch=" ARDUINO_VARIANT);
dln("Board=" ARDUINO_BOARD);
d("Freq="); dln(F_CPU/1e+6);
dln("Platform=" PANO_PLATFORM);
d("Freq="); d(F_CPU/1e+6); dln("MHz");
dln("BatteryMin=6.0"); // FIXME: should come from motor
d("MaxSpeedA="); dln(platformSpeed(max_horiz_rpm, horiz_gear_ratio));
d("MaxSpeedC="); dln(platformSpeed(max_vert_rpm, vert_gear_ratio));
Expand Down

0 comments on commit 0126190

Please sign in to comment.