Fixed compiler warnings

This commit is contained in:
Mark van Renswoude 2018-04-22 10:39:07 +02:00
parent ec99be4b7c
commit 627d3deed7
6 changed files with 72 additions and 28 deletions

View File

@ -207,7 +207,7 @@ gulp.task('embedVersion', function(cb)
headerFile += "const uint8_t VersionMajor = " + version.Major + ";\r\n";
headerFile += "const uint8_t VersionMinor = " + version.Minor + ";\r\n";
headerFile += "const uint8_t VersionPatch = " + version.Patch + ";\r\n";
headerFile += "const uint8_t VersionMetadata = " + version.BuildMetaData + ";\r\n";
headerFile += "const uint8_t VersionMetadata = " + (version.BuildMetaData ? version.BuildMetaData : '0') + ";\r\n";
headerFile += "const char VersionBranch[] = \"" + version.BranchName + "\";\r\n";

View File

@ -4,7 +4,7 @@
const uint8_t VersionMajor = 2;
const uint8_t VersionMinor = 1;
const uint8_t VersionPatch = 0;
const uint8_t VersionMetadata = ;
const uint8_t VersionMetadata = 0;
const char VersionBranch[] = "develop";
const char VersionSemVer[] = "2.1.0-unstable.3";
const char VersionFullSemVer[] = "2.1.0-unstable.3";

46
src/config.cpp Normal file
View File

@ -0,0 +1,46 @@
/*
* Stairs
* Copyright 2017 (c) Mark van Renswoude
*
* https://git.x2software.net/pub/Stairs
*/
#include "./config.h"
#ifdef SerialDebug
const uint32_t SerialDebugBaudrate = 115200;
const uint32_t SerialDebugStartupDelay = 2000;
#endif
const char* ConnectionSettingsFile = "/connection.json";
const char* SystemSettingsFile = "/system.json";
const char* StepsSettingsFile = "/steps.json";
const char* TimeTriggerSettingsFile = "/timetriggers.json";
const char* MotionTriggerSettingsFile = "/motiontriggers.json";
const char* DefaultAPSSIDPrefix = "Stairs-";
const char* DefaultNTPServer = "pool.ntp.org";
// Timeout when in AP + station mode (otherwise trying to connect
// to the STA will block the AP)
const uint32_t StationModeTimeout = 30000;
const uint16_t APButtonHoldTime = 2000;
// Only used if the timezone has not been succesfully retrieved yet, otherwise
// the configurable NTP interval is used
const uint32_t TimezoneRetryInterval = 60000;
#ifdef MapsAPIViaProxyScript
const char* TimezoneProxyScriptHost = "api.x2software.net";
const char* TimezoneProxyScriptPath = "/timezone.php";
#endif
const uint8_t InitialisationBrightness = 40;
const uint8_t InitialisationFadeTime = 250;
const uint8_t InitialisationBlinkCount = 2;

View File

@ -20,32 +20,27 @@
#ifdef SerialDebug
static const uint32_t SerialDebugBaudrate = 115200;
static const uint32_t SerialDebugStartupDelay = 2000;
extern const uint32_t SerialDebugBaudrate;
extern const uint32_t SerialDebugStartupDelay;
#endif
static const char* ConnectionSettingsFile = "/connection.json";
static const char* SystemSettingsFile = "/system.json";
static const char* StepsSettingsFile = "/steps.json";
static const char* TimeTriggerSettingsFile = "/timetriggers.json";
static const char* MotionTriggerSettingsFile = "/motiontriggers.json";
extern const char* ConnectionSettingsFile;
extern const char* SystemSettingsFile;
extern const char* StepsSettingsFile;
extern const char* TimeTriggerSettingsFile;
extern const char* MotionTriggerSettingsFile;
static const char* DefaultAPSSIDPrefix = "Stairs-";
extern const char* DefaultAPSSIDPrefix;
static const char* DefaultNTPServer = "pool.ntp.org";
extern const char* DefaultNTPServer;
// Timeout when in AP + station mode (otherwise trying to connect
// to the STA will block the AP)
static const uint32_t StationModeTimeout = 30000;
static const uint16_t APButtonHoldTime = 2000;
extern const uint32_t StationModeTimeout;
extern const uint16_t APButtonHoldTime;
// Only used if the timezone has not been succesfully retrieved yet, otherwise
// the configurable NTP interval is used
static const uint32_t TimezoneRetryInterval = 60000;
extern const uint32_t TimezoneRetryInterval;
// SSL takes quite a bit of memory (and I haven't been optimizing much),
@ -66,13 +61,13 @@ static const uint32_t TimezoneRetryInterval = 60000;
#define MapsAPIViaProxyScript
#ifdef MapsAPIViaProxyScript
static const char* TimezoneProxyScriptHost = "api.x2software.net";
static const char* TimezoneProxyScriptPath = "/timezone.php";
extern const char* TimezoneProxyScriptHost;
extern const char* TimezoneProxyScriptPath;
#endif
static const uint8_t InitialisationBrightness = 40;
static const uint8_t InitialisationFadeTime = 250;
static const uint8_t InitialisationBlinkCount = 2;
extern const uint8_t InitialisationBrightness;
extern const uint8_t InitialisationFadeTime;
extern const uint8_t InitialisationBlinkCount;
#endif

View File

@ -48,10 +48,10 @@ class StepsSettings : public AbstractJsonSettings
void useCurve(bool value) { mUseCurve = value; }
uint16_t rangeStart(uint8_t step) { return step < MaxStepCount ? mRange[step].start : 0; }
uint16_t rangeStart(uint8_t step, uint16_t value) { if (step < MaxStepCount) mRange[step].start = value; }
void rangeStart(uint8_t step, uint16_t value) { if (step < MaxStepCount) mRange[step].start = value; }
uint16_t rangeEnd(uint8_t step) { return step < MaxStepCount ? mRange[step].end : 0; }
uint16_t rangeEnd(uint8_t step, uint16_t value) { if (step < MaxStepCount) mRange[step].end = value; }
void rangeEnd(uint8_t step, uint16_t value) { if (step < MaxStepCount) mRange[step].end = value; }
};
#endif

View File

@ -39,9 +39,8 @@ DayOfWeek toDayOfWeek(timeDayOfWeek_t timeDay)
case dowThursday: return Thursday;
case dowFriday: return Friday;
case dowSaturday: return Saturday;
default: return Monday;
}
return Monday;
}
@ -163,6 +162,10 @@ TimeTrigger* TimeTriggerSettings::getActiveTrigger(tmElements_t &time)
case RelativeToSunset:
triggerTime += sunsetMinutes;
break;
case FixedTime:
// No changes (but eliminates warning)
break;
}
// Check if the current time is after the time set in the trigger, and