From d6730e82e6709c78c86960c0dc371e5f711cd09d Mon Sep 17 00:00:00 2001 From: elamre Date: Fri, 11 Aug 2017 10:50:48 +0200 Subject: [PATCH 1/2] Fix for the revision 1 channels --- software/app/application.cpp | 8 +------- software/app/web_interface.cpp | 5 +++++ software/{app => include}/hardware.h | 8 ++++++++ 3 files changed, 14 insertions(+), 7 deletions(-) rename software/{app => include}/hardware.h (83%) diff --git a/software/app/application.cpp b/software/app/application.cpp index e8c22da..b74463e 100644 --- a/software/app/application.cpp +++ b/software/app/application.cpp @@ -2,19 +2,13 @@ #include #include #include "ads101x.h" -#include "hardware.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; diff --git a/software/app/web_interface.cpp b/software/app/web_interface.cpp index b3c1a4d..d8adc47 100644 --- a/software/app/web_interface.cpp +++ b/software/app/web_interface.cpp @@ -71,8 +71,13 @@ void cWebInterface::OnRefresh(HttpRequest &request, HttpResponse &response) { json["adc_0"] = m_adc_value[0]; json["adc_1"] = m_adc_value[1]; +#ifdef REV_1 + json["adc_2"] = m_adc_value[3]; + json["adc_3"] = m_adc_value[2]; +#else json["adc_2"] = m_adc_value[2]; json["adc_3"] = m_adc_value[3]; +#endif response.sendJsonObject(stream); } diff --git a/software/app/hardware.h b/software/include/hardware.h similarity index 83% rename from software/app/hardware.h rename to software/include/hardware.h index 8e1f60b..ba6e580 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 = 0x48; static const uint8_t DAC1_ADDRESS = 0xC; @@ -18,4 +20,10 @@ static const uint8_t DAC1_ADDRESS = 0xC; #define R_SENSE_DIV_FACT 100 // 100 Ohm sensing resistor #define CURR_MAX_UAMP 10000 // 10 mA max. +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_ */ From e91588c8e8e2e51c891bfe6d4492f42283e1cc2a Mon Sep 17 00:00:00 2001 From: elamre Date: Fri, 11 Aug 2017 10:53:18 +0200 Subject: [PATCH 2/2] Renamed channels --- software/app/web_interface.cpp | 12 ++++++------ software/files/index.html | 16 ++++++++-------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/software/app/web_interface.cpp b/software/app/web_interface.cpp index d8adc47..9e4dab0 100644 --- a/software/app/web_interface.cpp +++ b/software/app/web_interface.cpp @@ -69,14 +69,14 @@ 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_1"] = m_adc_value[0]; + json["adc_2"] = m_adc_value[1]; #ifdef REV_1 - json["adc_2"] = m_adc_value[3]; - json["adc_3"] = m_adc_value[2]; -#else - json["adc_2"] = m_adc_value[2]; 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}