         Serial0.println("starting stream");
         break;
       case 's':
-        streaming = true;
+        streaming = false;
         Serial0.println("stopping stream");
         break;
+      case 'w':
+          wifi = !wifi;
+          if (wifi) {
+            Serial0.println("enabled wifi mode");
+          } else {
+            Serial0.println("disabled wifi mode");
+          }
+          break;
       case '0':
         digitalWrite(WIFI_SS,LOW);
         Serial0.println("forced pin 13 to low");

void flushbufToSpi() {
  uint8_t i = 0;
  uint8_t len = packetSize;
  digitalWrite(WIFI_SS,LOW);
  spi.transfer(0x02);
  spi.transfer(0x00);
  while(len-- && i < packetSize) {
      spi.transfer(buf[i++]);
  }
  while(i++ < packetSize) {
      spi.transfer(0); // Pad with zeros till 32
  }
  digitalWrite(WIFI_SS,HIGH);
}

#include <DSPI.h>

int packetSendIntervalMs = 500; // 50 ms
unsigned long lastPacketSent = millis();
const int packetSize = 32;
uint8_t buf[packetSize];
uint8_t WIFI_SS = 13;

DSPI0 spi;  // use DSPI library

boolean streaming = false;
boolean wifi = false;

void setup() {

