diff --git a/software/app/application.cpp b/software/app/application.cpp index eeed28f..b74463e 100644 --- a/software/app/application.cpp +++ b/software/app/application.cpp @@ -2,19 +2,13 @@ #include #include #include "ads101x.h" -#include "defines.h" +#include #include "excitation_light.h" #include "sensor_hub.h" #include "sensor_settings.h" #include "double_buffer.h" #include "web_interface.h" #include -#define LED_PIN 2 // GPIO2 - -static const int HUB_PERIOD = 5; -static const int ADC_TIMEBASE = 250; -static const int ADC_PERIOD = 5; -//static const uint8_t ADC_ADDRESS = 0x48; using namespace rijnfel; @@ -40,11 +34,6 @@ void SettingsTest() { Serial.printf("Settings: %d\n\r", adc.GetSettings()); } -void GenerateRectangle() -{ - mylight.RectangleUpdate(); -} - void AdcTest() { channel++; if (channel > 3) { @@ -83,7 +72,6 @@ void init() { //WDT.enable(false); pinMode(LED_PIN, OUTPUT); - digitalWrite(LED_PIN, 1); adc.SetMux(ads::eInputMux::AIN_0); adc.SetSampleSpeed(ads::eSampleSpeed::SPS_3300); adc.SetGain(ads::eGainAmplifier::FSR_4_096); @@ -101,13 +89,11 @@ void init() { WifiAccessPoint.config("Sensus", "", AUTH_OPEN, false, 3);*/ cWebInterface::GetInstance()->Start(); - procTimer.initializeMs(HUB_PERIOD, updateSensorHub).start(); + //procTimer.initializeMs(HUB_PERIOD, updateSensorHub).start(); //procTimer.initializeMs(1000, AdcTest).start(); - //procTimer.initializeMs(5000, SettingsTest).start(); - mylight.SetCurrent(1000); - //mylight.DeactivateLED(); - //procTimer.initializeUs(2500, GenerateRectangle).start(); - + procTimer.initializeMs(5000, SettingsTest).start(); + mylight.SetCurrent(5000); + mylight.RectangleUpdate(); } void STADisconnect(String ssid, uint8_t ssid_len, uint8_t bssid[6], diff --git a/software/app/web_interface.cpp b/software/app/web_interface.cpp index b3c1a4d..9e4dab0 100644 --- a/software/app/web_interface.cpp +++ b/software/app/web_interface.cpp @@ -69,10 +69,15 @@ void cWebInterface::OnRefresh(HttpRequest &request, HttpResponse &response) { JsonObjectStream* stream = new JsonObjectStream(); JsonObject& json = stream->getRoot(); - json["adc_0"] = m_adc_value[0]; - json["adc_1"] = m_adc_value[1]; - json["adc_2"] = m_adc_value[2]; + json["adc_1"] = m_adc_value[0]; + json["adc_2"] = m_adc_value[1]; +#ifdef REV_1 json["adc_3"] = m_adc_value[3]; + json["adc_4"] = m_adc_value[2]; +#else + json["adc_3"] = m_adc_value[2]; + json["adc_4"] = m_adc_value[3]; +#endif response.sendJsonObject(stream); } diff --git a/software/files/index.html b/software/files/index.html index 8b9a876..8e0bfb0 100644 --- a/software/files/index.html +++ b/software/files/index.html @@ -35,10 +35,10 @@
-

Channel 0

+

Channel 1

-

{adc_0}

+

{adc_1}

@@ -47,10 +47,10 @@
-

Channel 1

+

Channel 2

-

{adc_1}

+

{adc_2}

@@ -61,10 +61,10 @@
-

Channel 2

+

Channel 3

-

{adc_2}

+

{adc_3}

@@ -73,10 +73,10 @@
-

Channel 3

+

Channel 4

-

{adc_3}

+

{adc_4}

diff --git a/software/app/hardware.h b/software/include/hardware.h similarity index 85% rename from software/app/hardware.h rename to software/include/hardware.h index 7ba0661..0aa1a0a 100644 --- a/software/app/hardware.h +++ b/software/include/hardware.h @@ -11,6 +11,8 @@ #ifndef APP_HARDWARE_H_ #define APP_HARDWARE_H_ +#define REV_1 + //-------------------------------------I2C ADRESSES--------------------------------------------------------------------------- static const uint8_t ADC_ADDRESS = 0x49; static const uint8_t DAC1_ADDRESS = 0xE; @@ -20,4 +22,10 @@ static const uint16_t CURR_MAX_UAMP = 10000; // 10 mA max. static const uint16_t VREF_DAC = 3300; // in mV static const uint16_t RESOLUTION_DAC = 1024; +static const int HUB_PERIOD = 5; +static const int ADC_TIMEBASE = 250; +static const int ADC_PERIOD = 5; + +#define LED_PIN 2 // GPIO2 + #endif /* APP_HARDWARE_H_ */