|
@@ -184,10 +184,29 @@ void loop() {
|
|
|
lcd_sleep();
|
|
|
}
|
|
|
|
|
|
- if(M5.BtnA.read()){
|
|
|
+ M5.update();
|
|
|
+//send message on button state change
|
|
|
+ if(M5.BtnA.wasPressed()){
|
|
|
lcd_wakeup();
|
|
|
+ sendOSC("/button/A", 1);
|
|
|
}
|
|
|
-
|
|
|
+ else if(M5.BtnA.wasReleased()){
|
|
|
+ sendOSC("/button/A", 0);
|
|
|
+ }
|
|
|
+ if(M5.BtnB.wasPressed()){
|
|
|
+ lcd_wakeup();
|
|
|
+ sendOSC("/button/B", 1);
|
|
|
+ }
|
|
|
+ else if(M5.BtnB.wasReleased()){
|
|
|
+ sendOSC("/button/B", 0);
|
|
|
+ }
|
|
|
+ if(M5.BtnC.wasPressed()){
|
|
|
+ lcd_wakeup();
|
|
|
+ sendOSC("/button/C", 1);
|
|
|
+ }
|
|
|
+ else if(M5.BtnC.wasReleased()){
|
|
|
+ sendOSC("/button/C", 0);
|
|
|
+ }
|
|
|
|
|
|
if (calib_flag)
|
|
|
{
|
|
@@ -199,7 +218,7 @@ void loop() {
|
|
|
|
|
|
portal.handleClient();
|
|
|
handle_OSC();
|
|
|
-
|
|
|
+
|
|
|
//send sensor data
|
|
|
if(millis()-last_sent>sensor_rate){
|
|
|
last_sent = millis();
|
|
@@ -210,22 +229,9 @@ void loop() {
|
|
|
sendOSC_3f("/ahrs_smooth", yaw_smooth.get(), pitch_smooth.get(), roll_smooth.get());
|
|
|
}
|
|
|
|
|
|
-
|
|
|
|
|
|
drawNetworkInfo(0, 65);
|
|
|
drawSensorInfo(0, 120);
|
|
|
- // M5.Lcd.setCursor(0, 65);
|
|
|
- // M5.Lcd.printf("%6.2f %6.2f %6.2f ", gyroX, gyroY, gyroZ);
|
|
|
- // M5.Lcd.setCursor(220, 80);
|
|
|
- // M5.Lcd.print(" o/s");
|
|
|
- // M5.Lcd.setCursor(0, 120);
|
|
|
- // M5.Lcd.printf(" %5.2f %5.2f %5.2f ", accX, accY, accZ);
|
|
|
- // M5.Lcd.setCursor(220, 135);
|
|
|
- // M5.Lcd.print(" G");
|
|
|
- // M5.Lcd.setCursor(0, 165);
|
|
|
- // M5.Lcd.printf(" %5.2f %5.2f %5.2f ", pitch, roll, yaw);
|
|
|
- // M5.Lcd.setCursor(220, 180);
|
|
|
- // M5.Lcd.print(" degree");
|
|
|
- // M5.Lcd.setCursor(0, 220);
|
|
|
- // M5.Lcd.printf("Temperature : %.2f C", temp);
|
|
|
+
|
|
|
+
|
|
|
}
|