Make compass information sendable

This commit is contained in:
Nico Schottelius 2016-10-24 21:43:59 +02:00
parent 10edd719ca
commit 2b37c75c15
2 changed files with 17 additions and 20 deletions

View file

@ -12,12 +12,22 @@ void setupCompass()
compass.enableDefault(); compass.enableDefault();
} }
void readCompass() String getCompass()
{ {
compass.read(); String tmps;
compass.read();
snprintf(compassReport, sizeof(compassReport), "A: %6d %6d %6d M: %6d %6d %6d", tmps = String("compass.a.x=" ) + compass.a.x +
compass.a.x, compass.a.y, compass.a.z, String(" compass.a.y=" ) + compass.a.y +
compass.m.x, compass.m.y, compass.m.z); String(" compass.a.z=" ) + compass.a.z +
String(" compass.m.x=" ) + compass.m.x +
String(" compass.m.y" ) + compass.m.y +
String(" compass.m.z=" ) + compass.m.z;
debugSerial.println(tmps);
/* snprintf(compassReport, sizeof(compassReport), "A: %6d %6d %6d M: %6d %6d %6d", */
/* compass.a.x, compass.a.y, compass.a.z, */
/* compass.m.x, compass.m.y, compass.m.z); */
} }

View file

@ -11,11 +11,6 @@
#define USE_LOUDNESS 1 #define USE_LOUDNESS 1
#define BUZZER_PIN 2 #define BUZZER_PIN 2
void sendBatVoltage() {
String battery = String("bat1=") + String(getBatteryVoltage());
sendPacket(battery);
}
void signal_loop_start() void signal_loop_start()
{ {
blink(30); delay(50); blink(30); delay(50);
@ -53,7 +48,6 @@ void sendIntAsString(String prefix, int value) {
} }
String tmps; String tmps;
int tmpi;
void loop() { void loop() {
signal_loop_start(); signal_loop_start();
@ -61,15 +55,8 @@ void loop() {
loraSend(String("node=") + String(deviceNo)); loraSend(String("node=") + String(deviceNo));
sendIntAsString("battery=", getBatteryVoltage()); sendIntAsString("battery=", getBatteryVoltage());
sendIntAsString("loudness=", readLoudness()); sendIntAsString("loudness=", readLoudness());
loraSend(getSunLight());
tmps = getSunLight(); loraSend(getCompass());
debugSerial.println(tmps);
loraSend(tmps);
readCompass();
debugSerial.println(compassReport);
// buzz(30);
/* if((tmps = gpsGetPostion(120)) != "") { */ /* if((tmps = gpsGetPostion(120)) != "") { */
/* loraSend(tmps); */ /* loraSend(tmps); */