Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
elcojacobs committed Jan 8, 2018
2 parents 72e6331 + b20ac9a commit b18a0eb
Show file tree
Hide file tree
Showing 4,817 changed files with 979,552 additions and 126,796 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ install:
- ./ci/install_arm_gcc.sh
- ./platform/spark/firmware/ci/install_gcc.sh
- source ./ci/install_boost.sh
- sudo apt-get install libarchive-zip-perl # for crc32

script:
- ./ci/build.sh
Expand Down
2 changes: 1 addition & 1 deletion app/Brewpi.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@
#include <AppConfig.h>
#include "AppConfigDefault.h"

#define VERSION_STRING "0.5.2"
#define VERSION_STRING "0.5.4"
2 changes: 1 addition & 1 deletion app/cbox/Logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// will later refactor and decouple the the sensor from logging


void Logger::logMessageVaArg(char type, LOG_ID_TYPE errorID, const char * varTypes, ...){
void BrewPiLogger::logMessageVaArg(char type, LOG_ID_TYPE errorID, const char * varTypes, ...){

}

6 changes: 5 additions & 1 deletion app/cbox/build.mk
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,8 @@ CPPSRC += $(call here_files,platform/spark/libs/mdns/firmware,*.cpp)

GIT_VERSION = $(shell cd $(SOURCE_PATH); git describe --long)
$(info using $(GIT_VERSION) as build name)
CFLAGS += -DBUILD_NAME="$(GIT_VERSION)"
CFLAGS += -DBUILD_NAME="$(GIT_VERSION)"

COMPILER_VERSION = $(shell $(CC) --version)
$(info using compiler: $(COMPILER_VERSION))

3 changes: 2 additions & 1 deletion app/cbox/env.mk
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export USE_PRINTF_FLOAT=n
export SPARK_CLOUD=n
export SPARK_CLOUD=y
export WARNINGS_AS_ERRORS=n
2 changes: 1 addition & 1 deletion app/cbox/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ ScaledTicksValue ticks;
// todo - add a system object that describes the application version
// from this, the protocol of all objects can be determined by the client.


SYSTEM_MODE(MANUAL);
SYSTEM_THREAD(ENABLED);

void connectionStarted(StandardConnection& connection, DataOut& out)
Expand Down
9 changes: 9 additions & 0 deletions app/controller/Brewpi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ void setup()
settingsManager.loadSettings();

control.update();

if(WiFi.hasCredentials()){
Particle.connect();
}

logDebug("init complete");
}
Expand All @@ -109,6 +113,11 @@ void brewpiLoop(void)

//listen for incoming serial connections while waiting to update
piLink.receive();

// System thread enable mode is used so this is not necessary to keep the cloud
// connection is alive, but it is necessary to handle the system events, including
// the button, so it's here, regardless of the connection state.
Particle.process();
}

void loop() {
Expand Down
9 changes: 4 additions & 5 deletions app/controller/BrewpiStrings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,10 @@
#include "BrewpiStrings.h"

// some useful strings
const char STR_FMT_S_RAM[] PROGMEM = "%s"; // RAM string
const char STR_FMT_S_PROGMEM[] PROGMEM = "%S"; // PROGMEM string
const char STR_FMT_D[] PROGMEM = "%d";
const char STR_FMT_U[] PROGMEM = "%u";
const char STR_6SPACES[] PROGMEM = " ";
const char STR_FMT_S_RAM[] = "%s"; // RAM string
const char STR_FMT_D[] = "%d";
const char STR_FMT_U[] = "%u";
const char STR_6SPACES[] = " ";



Expand Down
1 change: 0 additions & 1 deletion app/controller/BrewpiStrings.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include <stdint.h>

extern const char STR_FMT_S_RAM[];
extern const char STR_FMT_S_PROGMEM[];
extern const char STR_FMT_U[];
extern const char STR_FMT_D[];
extern const char STR_6SPACES[];
Expand Down
12 changes: 6 additions & 6 deletions app/controller/DeviceManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ bool first = false) {

char tempString[32]; // resulting string limited to 128 chars

sprintf_P(tempString, PSTR("\"%c\":%d"), c, val);
sprintf(tempString, "\"%c\":%d", c, val);
p.print(tempString);
}

Expand Down Expand Up @@ -728,7 +728,7 @@ void DeviceManager::readTempSensorValue(DeviceConfig::Hardware hw,
}
temp.toTempString(out, 3, 9, tempControl.cc.tempFormat, true);
#else
strcpy_P(out, PSTR("0.00"));
strcpy(out, "0.00");
#endif
}

Expand All @@ -739,7 +739,7 @@ void DeviceManager::readNotInstalledValve(DeviceConfig::Hardware hw,
auto hwDevice = std::make_shared<DS2408>(oneWireBus(hw.pinNr), hw.address);
ValveController valve(hwDevice, hw.settings.actuator.pio);
uint8_t valveState = valve.read(true);
sprintf_P(out, STR_FMT_U, (unsigned int) valveState);
sprintf(out, STR_FMT_U, (unsigned int) valveState);
}

void DeviceManager::writeNotInstalledValve(DeviceConfig::Hardware hw, uint8_t value)
Expand All @@ -759,7 +759,7 @@ void DeviceManager::writeNotInstalledPin(DeviceConfig::Hardware hw, uint8_t valu

void DeviceManager::readNotInstalledPin(DeviceConfig::Hardware hw, char * out){
unsigned int state = digitalRead(hw.pinNr) ^ hw.invert;
sprintf_P(out, STR_FMT_U, state);
sprintf(out, STR_FMT_U, state);
}

#if BREWPI_DS2413
Expand All @@ -774,7 +774,7 @@ void DeviceManager::readNotInstalledOneWirePin(DeviceConfig::Hardware hw, char *
auto hwDevice = std::make_shared<DS2413>(oneWireBus(hw.pinNr), hw.address);
ActuatorOneWire pin(hwDevice, hw.settings.actuator.pio, hw.invert);
unsigned int state = pin.isActive();
sprintf_P(out, STR_FMT_U, state);
sprintf(out, STR_FMT_U, state);
}
#endif

Expand Down Expand Up @@ -1046,7 +1046,7 @@ void DeviceManager::UpdateDeviceState(DeviceDisplay & dd, DeviceConfig & dc, ch
} else if (dt == DEVICETYPE_SWITCH_ACTUATOR){
auto act = asInterface<ActuatorDigital>(devices[idx]);
if(act != nullptr){
sprintf_P(val, STR_FMT_U, (unsigned int) act->isActive() != 0);
sprintf(val, STR_FMT_U, (unsigned int) act->isActive() != 0);
}
} else if (dc.deviceFunction == DEVICE_CHAMBER_MANUAL_ACTUATOR){
#if BREWPI_DS2408
Expand Down
2 changes: 1 addition & 1 deletion app/controller/EepromManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ void EepromManager::initializeEeprom()
tempControl.storeConstants(pv+offsetof(ChamberBlock, chamberSettings.cc));
pv += offsetof(ChamberBlock, beer)+offsetof(BeerBlock, cs);
for (uint8_t b=0; b<ChamberBlock::MAX_BEERS; b++) {
// logDeveloper(PSTR("EepromManager - saving settings for beer %d at %d"), b, (uint16_t)pv);
// logDeveloper("EepromManager - saving settings for beer %d at %d", b, (uint16_t)pv);
tempControl.storeSettings(pv);
pv += sizeof(BeerBlock); // advance to next beer
}
Expand Down
66 changes: 33 additions & 33 deletions app/controller/JsonKeys.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,45 +22,45 @@
#include "Brewpi.h"

// settings
static const char JSONKEY_mode[] PROGMEM = "mode";
static const char JSONKEY_beerSetting[] PROGMEM = "beerSet";
static const char JSONKEY_fridgeSetting[] PROGMEM = "fridgeSet";
static const char JSONKEY_mode[] = "mode";
static const char JSONKEY_beerSetting[] = "beerSet";
static const char JSONKEY_fridgeSetting[] = "fridgeSet";

// constant;
static const char JSONKEY_tempFormat[] PROGMEM = "tempFormat";
static const char JSONKEY_tempFormat[] = "tempFormat";

static const char JSONKEY_heater1_kp[] PROGMEM = "heater1_kp";
static const char JSONKEY_heater1_ti[] PROGMEM = "heater1_ti";
static const char JSONKEY_heater1_td[] PROGMEM = "heater1_td";
static const char JSONKEY_heater1_infilt[] PROGMEM = "heater1_infilt";
static const char JSONKEY_heater1_dfilt[] PROGMEM = "heater1_dfilt";
static const char JSONKEY_heater1_kp[] = "heater1_kp";
static const char JSONKEY_heater1_ti[] = "heater1_ti";
static const char JSONKEY_heater1_td[] = "heater1_td";
static const char JSONKEY_heater1_infilt[] = "heater1_infilt";
static const char JSONKEY_heater1_dfilt[] = "heater1_dfilt";

static const char JSONKEY_heater2_kp[] PROGMEM = "heater2_kp";
static const char JSONKEY_heater2_ti[] PROGMEM = "heater2_ti";
static const char JSONKEY_heater2_td[] PROGMEM = "heater2_td";
static const char JSONKEY_heater2_infilt[] PROGMEM = "heater2_infilt";
static const char JSONKEY_heater2_dfilt[] PROGMEM = "heater2_dfilt";
static const char JSONKEY_heater2_kp[] = "heater2_kp";
static const char JSONKEY_heater2_ti[] = "heater2_ti";
static const char JSONKEY_heater2_td[] = "heater2_td";
static const char JSONKEY_heater2_infilt[] = "heater2_infilt";
static const char JSONKEY_heater2_dfilt[] = "heater2_dfilt";

static const char JSONKEY_cooler_kp[] PROGMEM = "cooler_kp";
static const char JSONKEY_cooler_ti[] PROGMEM = "cooler_ti";
static const char JSONKEY_cooler_td[] PROGMEM = "cooler_td";
static const char JSONKEY_cooler_infilt[] PROGMEM = "cooler_infilt";
static const char JSONKEY_cooler_dfilt[] PROGMEM = "cooler_dfilt";
static const char JSONKEY_cooler_kp[] = "cooler_kp";
static const char JSONKEY_cooler_ti[] = "cooler_ti";
static const char JSONKEY_cooler_td[] = "cooler_td";
static const char JSONKEY_cooler_infilt[] = "cooler_infilt";
static const char JSONKEY_cooler_dfilt[] = "cooler_dfilt";

static const char JSONKEY_beer2fridge_kp[] PROGMEM = "beer2fridge_kp";
static const char JSONKEY_beer2fridge_ti[] PROGMEM = "beer2fridge_ti";
static const char JSONKEY_beer2fridge_td[] PROGMEM = "beer2fridge_td";
static const char JSONKEY_beer2fridge_infilt[] PROGMEM = "beer2fridge_infilt";
static const char JSONKEY_beer2fridge_dfilt[] PROGMEM = "beer2fridge_dfilt";
static const char JSONKEY_beer2fridge_pidMax[] PROGMEM = "beer2fridge_pidMax";
static const char JSONKEY_beer2fridge_kp[] = "beer2fridge_kp";
static const char JSONKEY_beer2fridge_ti[] = "beer2fridge_ti";
static const char JSONKEY_beer2fridge_td[] = "beer2fridge_td";
static const char JSONKEY_beer2fridge_infilt[] = "beer2fridge_infilt";
static const char JSONKEY_beer2fridge_dfilt[] = "beer2fridge_dfilt";
static const char JSONKEY_beer2fridge_pidMax[] = "beer2fridge_pidMax";

static const char JSONKEY_minCoolTime[] PROGMEM = "minCoolTime";
static const char JSONKEY_minCoolIdleTime[] PROGMEM = "minCoolIdleTime";
static const char JSONKEY_heater1PwmPeriod[] PROGMEM = "heater1PwmPeriod";
static const char JSONKEY_heater2PwmPeriod[] PROGMEM = "heater2PwmPeriod";
static const char JSONKEY_coolerPwmPeriod[] PROGMEM = "coolerPwmPeriod";
static const char JSONKEY_minCoolTime[] = "minCoolTime";
static const char JSONKEY_minCoolIdleTime[] = "minCoolIdleTime";
static const char JSONKEY_heater1PwmPeriod[] = "heater1PwmPeriod";
static const char JSONKEY_heater2PwmPeriod[] = "heater2PwmPeriod";
static const char JSONKEY_coolerPwmPeriod[] = "coolerPwmPeriod";

static const char JSONKEY_mutexDeadTime[] PROGMEM = "deadTime";
static const char JSONKEY_mutexDeadTime[] = "deadTime";

static const char JSONKEY_logType[] PROGMEM = "logType";
static const char JSONKEY_logID[] PROGMEM = "logID";
static const char JSONKEY_logType[] = "logType";
static const char JSONKEY_logID[] = "logID";
14 changes: 7 additions & 7 deletions app/controller/Logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,27 @@
#include "PiLink.h"
#include "JsonKeys.h"

static const char PROGMEM LOG_STRING_FORMAT[] = "\"%s\"";
static const char LOG_STRING_FORMAT[] = "\"%s\"";

void Logger::logMessageVaArg(char type, LOG_ID_TYPE errorID, const char * varTypes, ...){
void BrewPiLogger::logMessageVaArg(char type, LOG_ID_TYPE errorID, const char * varTypes, ...){
va_list args;
piLink.printResponse('D');
piLink.sendJsonPair(JSONKEY_logType, type);
piLink.sendJsonPair(JSONKEY_logID, errorID);
piLink.print_P(PSTR(",\"V\":["));
piLink.print(",\"V\":[");
va_start (args, varTypes);
uint8_t index = 0;
char buf[9];
while(varTypes[index]){
switch(varTypes[index]){
case 'd': // integer, signed or unsigned
piLink.print_P(STR_FMT_D, va_arg(args, int));
piLink.print(STR_FMT_D, va_arg(args, int));
break;
case 's': // string
piLink.print_P(LOG_STRING_FORMAT, va_arg(args, char*));
piLink.print(LOG_STRING_FORMAT, va_arg(args, char*));
break;
case 't': // temperature in fixed point format
piLink.print_P(LOG_STRING_FORMAT, (*(temp_t *) va_arg(args,void*)).toString(buf, 3, 12));
piLink.print(LOG_STRING_FORMAT, (*(temp_t *) va_arg(args,void*)).toString(buf, 3, 12));
break;
}
if(varTypes[++index]){
Expand All @@ -57,4 +57,4 @@ void Logger::logMessageVaArg(char type, LOG_ID_TYPE errorID, const char * varTyp
piLink.sendJsonClose();
}

Logger logger;
BrewPiLogger logger;
Loading

0 comments on commit b18a0eb

Please sign in to comment.