From 9e76479a7e1e11682009078c45ad307cb96c1066 Mon Sep 17 00:00:00 2001 From: ladyada Date: Sun, 10 Feb 2019 14:32:56 -0500 Subject: [PATCH] change pin to not conflict with boot, add some debugs --- arduino/libraries/SPIS/src/SPIS.cpp | 2 +- main/sketch.ino.cpp | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/arduino/libraries/SPIS/src/SPIS.cpp b/arduino/libraries/SPIS/src/SPIS.cpp index a692c61..0643106 100644 --- a/arduino/libraries/SPIS/src/SPIS.cpp +++ b/arduino/libraries/SPIS/src/SPIS.cpp @@ -113,4 +113,4 @@ void SPISClass::handleSetupComplete() xSemaphoreGiveFromISR(_readySemaphore, NULL); } -SPISClass SPIS(VSPI_HOST, 1, 12, 23, 18, 5, 33); +SPISClass SPIS(VSPI_HOST, 1, 14, 23, 18, 5, 33); diff --git a/main/sketch.ino.cpp b/main/sketch.ino.cpp index 17889f8..b7ac78a 100644 --- a/main/sketch.ino.cpp +++ b/main/sketch.ino.cpp @@ -66,6 +66,8 @@ void setDebug(int d) { // uartAttach(); ets_install_uart_printf(); uart_tx_switch(CONFIG_CONSOLE_UART_NUM); + + ets_printf("*** DEBUG ON\n"); } else { PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[1], PIN_FUNC_GPIO); PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[3], PIN_FUNC_GPIO); @@ -91,13 +93,17 @@ void setup() { pinMode(5, INPUT); if (digitalRead(5) == LOW) { + if (debug) ets_printf("*** BLUETOOTH ON\n"); + setupBluetooth(); } else { + if (debug) ets_printf("*** WIFI ON\n"); + setupWiFi(); } } -// #define UNO_WIFI_REV2 +#define UNO_WIFI_REV2 void setupBluetooth() { periph_module_enable(PERIPH_UART1_MODULE); @@ -133,23 +139,27 @@ void setupBluetooth() { void setupWiFi() { esp_bt_controller_mem_release(ESP_BT_MODE_BTDM); + if (debug) ets_printf("*** SPIS\n"); SPIS.begin(); if (WiFi.status() == WL_NO_SHIELD) { + if (debug) ets_printf("*** NOSHIELD\n"); while (1); // no shield } commandBuffer = (uint8_t*)heap_caps_malloc(SPI_BUFFER_LEN, MALLOC_CAP_DMA); responseBuffer = (uint8_t*)heap_caps_malloc(SPI_BUFFER_LEN, MALLOC_CAP_DMA); + if (debug) ets_printf("*** BEGIN\n"); CommandHandler.begin(); } void loop() { + if (debug) ets_printf("."); // wait for a command memset(commandBuffer, 0x00, SPI_BUFFER_LEN); int commandLength = SPIS.transfer(NULL, commandBuffer, SPI_BUFFER_LEN); - + if (debug) ets_printf("%d", commandLength); if (commandLength == 0) { return; }