Quellcode durchsuchen

basic structure to pass OSC msg to machine objects and route them internally to different functions
looks like a basic full OSC communication in classes !

eLandon vor 6 Jahren
Ursprung
Commit
50596230b8
1 geänderte Dateien mit 13 neuen und 6 gelöschten Zeilen
  1. 13 6
      HTequi-firmware/src/blobcnc_low/main.cpp

+ 13 - 6
HTequi-firmware/src/blobcnc_low/main.cpp

@@ -38,6 +38,7 @@
      atm_timer_millis timer;
 
      EthernetUDP* _udpRef ;
+     //Atm_blink& onOSC(OSCMessage& msg );
 
      enum { IDLE, LED_ON, LED_OFF }; // STATES
      enum { EVT_TIMER, EVT_ON, EVT_OFF, ELSE }; // EVENTS
@@ -67,12 +68,7 @@
      }
 
      void action( int id ) {
-       OSCMessage _msg("/blink");
-       _msg.add((int32_t)analogRead(0));
-       _udpRef->beginPacket(ipMulti, portMulti);
-       _msg.send(*_udpRef); // send the bytes to the SLIP stream
-       _udpRef->endPacket(); // mark the end of the OSC Packet
-       _msg.empty();
+
        switch ( id ) {
          case ENT_ON :
            digitalWrite( pin, HIGH );
@@ -83,7 +79,17 @@
            digitalWrite( pin, LOW );
            return;
        }
+     }
 
+     Atm_blink& onOSC(OSCMessage& msg ){
+       if(msg.fullMatch("/truc")){
+         OSCMessage _msg("/blink");
+         _msg.add("youpi");
+         _udpRef->beginPacket(ipMulti, portMulti);
+         _msg.send(*_udpRef); // send the bytes to the SLIP stream
+         _udpRef->endPacket(); // mark the end of the OSC Packet
+         _msg.empty();
+       }
      }
  };
 
@@ -147,6 +153,7 @@ void routeTone(OSCMessage &msg, int addrOffset ){
 
       if(!msgIn.hasError())
         msgIn.route("/blink", test);
+        led.onOSC(msgIn);
    }
 
    OSCMessage msg("/analog/0");