Skip to content

Commit

Permalink
TODO-1029: working on REV7 unnecessary draw
Browse files Browse the repository at this point in the history
  • Loading branch information
DamonHD committed Nov 5, 2016
1 parent b6aa6de commit c89b16c
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 38 deletions.
8 changes: 2 additions & 6 deletions Arduino/V0p2_Main/Control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ void bareStatsTX(const bool allowDoubleTX, const bool doBinary)
#endif

#if defined(ENABLE_OTSECUREFRAME_ENCODING_SUPPORT)
const bool doEnc = true;
const bool doEnc = false; // FIXME true;
#else
const bool doEnc = false;
#endif
Expand Down Expand Up @@ -664,8 +664,7 @@ DEBUG_SERIAL_PRINTLN_FLASHSTRING("JSON gen err!");
#endif // defined(ENABLE_STATS_TX)



// Wire components directly together, eg for occupancy sensing.
// Wire components together, eg for occupancy sensing.
static void wireComponentsTogether()
{
#ifdef ENABLE_FHT8VSIMPLE
Expand All @@ -684,9 +683,6 @@ static void wireComponentsTogether()
#endif // ENABLE_OCCUPANCY_DETECTION_FROM_VOICE

#if defined(TEMP_POT_AVAILABLE)
// TempPot.setOccCallback(genericMarkAsOccupied); // markUIControlUsed
// Mark UI as used and indirectly mark occupancy when control is used.
TempPot.setOccCallback([]{valveUI.markUIControlUsed();});
// Callbacks to set various mode combinations.
// Typically at most one call would be made on any appropriate pot adjustment.
TempPot.setWFBCallbacks([](bool x){valveUI.setWarmModeFromManualUI(x);},
Expand Down
50 changes: 32 additions & 18 deletions Arduino/V0p2_Main/V0p2_Main.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,23 @@ bool handleQueuedMessages(Print *p, bool wakeSerialIfNeeded, OTRadioLink::OTRadi
#endif


/////// CONTROL (EARLY, NOT DEPENDENT ON OTHER SENSORS)

// Radiator valve mode (FROST, WARM, BAKE).
extern OTRadValve::ValveMode valveMode;

// FIXME Moved up from line 464 to fix compilation errors (OccupancyTracker needed on line 261)
// IF DEFINED: support for general timed and multi-input occupancy detection / use.
#ifdef ENABLE_OCCUPANCY_SUPPORT
typedef OTV0P2BASE::PseudoSensorOccupancyTracker OccupancyTracker;
#else
// Placeholder class with dummy static status methods to reduce code complexity.
typedef OTV0P2BASE::DummySensorOccupancyTracker OccupancyTracker;
#endif
// Singleton implementation for entire node.
extern OccupancyTracker Occupancy;


////// SENSORS

// Sensor for supply (eg battery) voltage in millivolts.
Expand All @@ -185,7 +202,17 @@ extern OTV0P2BASE::SupplyVoltageCentiVolts Supply_cV;
#if (V0p2_REV >= 2) && defined(TEMP_POT_AIN) // Only supported in REV2/3/4/7.
#define TEMP_POT_AVAILABLE
// Sensor for temperature potentiometer/dial.
extern OTV0P2BASE::SensorTemperaturePot TempPot;
typedef OTV0P2BASE::SensorTemperaturePot
<
decltype(Occupancy), &Occupancy,
#if (V0p2_REV == 7)
48, 296, // Correct for DORM1/TRV1 with embedded REV7.
false // REV7 does not drive pot from IO_POWER_U.
#elif defined(TEMP_POT_REVERSE)
1023, 0
#endif
> TempPot_t;
extern TempPot_t TempPot;
#endif
#endif // ENABLE_TEMP_POT_IF_PRESENT

Expand Down Expand Up @@ -264,15 +291,12 @@ typedef OTRadValve::DEFAULT_ValveControlParameters PARAMS;
typedef OTRadValve::DEFAULT_DHW_ValveControlParameters PARAMS;
#endif

// Radiator valve mode (FROST, WARM, BAKE).
extern OTRadValve::ValveMode valveMode;

// Choose which subtype to use depending on enabled settings and board type.
#if defined(TEMP_POT_AVAILABLE) // Eg REV2/REV7.
#if defined(HUMIDITY_SENSOR_SUPPORT)
typedef OTRadValve::TempControlTempPot<&TempPot, PARAMS, decltype(RelHumidity), &RelHumidity> TempControl_t;
typedef OTRadValve::TempControlTempPot<decltype(TempPot), &TempPot, PARAMS, decltype(RelHumidity), &RelHumidity> TempControl_t;
#else
typedef OTRadValve::TempControlTempPot<&TempPot, PARAMS> TempControl_t;
typedef OTRadValve::TempControlTempPot<decltype(TempPot), &TempPot, PARAMS> TempControl_t;
#endif
#elif defined(ENABLE_SETTABLE_TARGET_TEMPERATURES) // Eg REV1.
typedef OTRadValve::TempControlSimpleEEPROMBacked<PARAMS> TempControl_t;
Expand Down Expand Up @@ -317,17 +341,6 @@ void setMinBoilerOnMinutes(uint8_t mins);
#define inStatsHubMode() (1 == getMinBoilerOnMinutes())
#endif // defined(ENABLE_DEFAULT_ALWAYS_RX)

// FIXME Moved up from line 464 to fix compilation errors (OccupancyTracker needed on line 261)
// IF DEFINED: support for general timed and multi-input occupancy detection / use.
#ifdef ENABLE_OCCUPANCY_SUPPORT
typedef OTV0P2BASE::PseudoSensorOccupancyTracker OccupancyTracker;
#else
// Placeholder class with dummy static status methods to reduce code complexity.
typedef OTV0P2BASE::DummySensorOccupancyTracker OccupancyTracker;
#endif
// Singleton implementation for entire node.
extern OccupancyTracker Occupancy;

// Period in minutes for simple learned on-time; strictly positive (and less than 256).
#ifndef LEARNED_ON_PERIOD_M
#define LEARNED_ON_PERIOD_M 60
Expand All @@ -341,7 +354,8 @@ extern OccupancyTracker Occupancy;
#if defined(ENABLE_SINGLETON_SCHEDULE)
#define SCHEDULER_AVAILABLE
// Singleton scheduler instance.
typedef OTV0P2BASE::SimpleValveSchedule<
typedef OTV0P2BASE::SimpleValveSchedule
<
LEARNED_ON_PERIOD_M, LEARNED_ON_PERIOD_COMFORT_M,
decltype(tempControl), &tempControl,
#if defined(ENABLE_OCCUPANCY_SUPPORT)
Expand Down
15 changes: 1 addition & 14 deletions Arduino/V0p2_Main/V0p2_Main.ino
Original file line number Diff line number Diff line change
Expand Up @@ -451,20 +451,7 @@ void setup()
OTV0P2BASE::SupplyVoltageCentiVolts Supply_cV;

#ifdef TEMP_POT_AVAILABLE
#if defined(TEMP_POT_REVERSE)
OTV0P2BASE::SensorTemperaturePot TempPot(OTV0P2BASE::SensorTemperaturePot::TEMP_POT_RAW_MAX, 0);
#else
#if (V0p2_REV != 7) // For DORM1/REV7 natural direction for temp dial pot is correct.
OTV0P2BASE::SensorTemperaturePot TempPot(0, OTV0P2BASE::SensorTemperaturePot::TEMP_POT_RAW_MAX);
#else
// DORM1 / REV7 initial unit range ~[45,293] DHD20160211 (seen <45 to >325).
// Thus could be ~30 points per item on scale: * 16 17 18 >19< 20 21 22 BOOST
// Actual precision/reproducability of pot is circa +/- 4.
static const uint16_t REV7_pot_low = 48;
static const uint16_t REV7_pot_high = 296;
OTV0P2BASE::SensorTemperaturePot TempPot(REV7_pot_low, REV7_pot_high);
#endif // (V0p2_REV != 7)
#endif // defined(TEMP_POT_REVERSE)
TempPot_t TempPot;
#endif

#ifdef ENABLE_AMBLIGHT_SENSOR
Expand Down

0 comments on commit c89b16c

Please sign in to comment.