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();
}
void readCompass()
String getCompass()
{
String tmps;
compass.read();
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);
tmps = String("compass.a.x=" ) + compass.a.x +
String(" compass.a.y=" ) + compass.a.y +
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 BUZZER_PIN 2
void sendBatVoltage() {
String battery = String("bat1=") + String(getBatteryVoltage());
sendPacket(battery);
}
void signal_loop_start()
{
blink(30); delay(50);
@ -53,7 +48,6 @@ void sendIntAsString(String prefix, int value) {
}
String tmps;
int tmpi;
void loop() {
signal_loop_start();
@ -61,15 +55,8 @@ void loop() {
loraSend(String("node=") + String(deviceNo));
sendIntAsString("battery=", getBatteryVoltage());
sendIntAsString("loudness=", readLoudness());
tmps = getSunLight();
debugSerial.println(tmps);
loraSend(tmps);
readCompass();
debugSerial.println(compassReport);
// buzz(30);
loraSend(getSunLight());
loraSend(getCompass());
/* if((tmps = gpsGetPostion(120)) != "") { */
/* loraSend(tmps); */