Skip to content

Commit

Permalink
Merge pull request #69 from uncodead/feature/1.0.16
Browse files Browse the repository at this point in the history
Feature/1.0.16
  • Loading branch information
uncodead authored Feb 23, 2021
2 parents d098c26 + 97b35cf commit a8bc1f2
Show file tree
Hide file tree
Showing 25 changed files with 107 additions and 22 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ Estou preparando uma versão 'PRO' com novas funcionalidades para atender a dema
* Exporting and importing brewing configurations / *Exportação e importação das configurações de brassagem*
* Post-boil heating additions and control (Whirlpool / Hop Stand) / *Adições e controle de aquecimento pós-fervura (whirlpool/hop stand)*
* Persistent temperature chart / *Gráfico de temperatura persistente*
* Reverse pump relay in settings / *Melhorias de performance*
* Reverse pump relay in settings / *Configuração para inverter o relé da bomba*
* Performance improvements / *Melhorias de performance*


![BrewUNO](http://brewuno.com/images/home-brewuno.png)
Expand Down
Binary file renamed bin/firmware_1.0.15.bin → bin/firmware_1.0.16.bin
Binary file not shown.
Binary file removed bin/spiffs_1.0.15.bin
Binary file not shown.
Binary file added bin/spiffs_1.0.16.bin
Binary file not shown.
4 changes: 3 additions & 1 deletion data/config/brewSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,7 @@
"mso": 0,
"sso": 0,
"bso": 0,
"tu": "C"
"tu": "C",
"ip": false,
"pa": 0
}
2 changes: 1 addition & 1 deletion data/www/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><link rel="stylesheet" href="/css/roboto.css"><link rel="manifest" href="/app/manifest.json"><title>BrewUNO</title><link href="/css/2.0af1.c.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script src="/js/1.b351.js"></script><script src="/js/2.474c.js"></script><script src="/js/0.ee0b.js"></script></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><link rel="stylesheet" href="/css/roboto.css"><link rel="manifest" href="/app/manifest.json"><title>BrewUNO</title><link href="/css/2.0af1.c.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script src="/js/1.b351.js"></script><script src="/js/2.60b4.js"></script><script src="/js/0.20a3.js"></script></body></html>
Binary file added data/www/js/0.20a3.js.gz
Binary file not shown.
Binary file removed data/www/js/0.ee0b.js.gz
Binary file not shown.
Binary file removed data/www/js/2.474c.js.gz
Binary file not shown.
Binary file added data/www/js/2.60b4.js.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion interface/.env.development
Original file line number Diff line number Diff line change
@@ -1 +1 @@
REACT_APP_ENDPOINT_ROOT=http://192.168.0.125/rest/
REACT_APP_ENDPOINT_ROOT=http://192.168.15.20/rest/
2 changes: 1 addition & 1 deletion interface/build/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><link rel="stylesheet" href="/css/roboto.css"><link rel="manifest" href="/app/manifest.json"><title>BrewUNO</title><link href="/css/2.0af1.c.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script src="/js/1.b351.js"></script><script src="/js/2.474c.js"></script><script src="/js/0.ee0b.js"></script></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><link rel="stylesheet" href="/css/roboto.css"><link rel="manifest" href="/app/manifest.json"><title>BrewUNO</title><link href="/css/2.0af1.c.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script src="/js/1.b351.js"></script><script src="/js/2.60b4.js"></script><script src="/js/0.20a3.js"></script></body></html>
34 changes: 33 additions & 1 deletion interface/src/forms/BrewSettingsForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ class BrewSettingsForm extends Component {
<MenuItem value={'C'}><IntText text="Celsius" /></MenuItem>
<MenuItem value={'F'}><IntText text="Fahrenheit" /></MenuItem>
</Select>

</Paper>
</Grid>

Expand Down Expand Up @@ -275,6 +274,21 @@ class BrewSettingsForm extends Component {
<Grid item xs={6}>
<Paper className={classes.root} style={PaperStyle}>
<Typography className={classes.formControl} color="textSecondary">{<IntText text="BrewSettings.PumpCycle" />}</Typography>
<div style={{ marginTop: 0, marginLeft: 20, padding: 0 }}>
<FormControlLabel
control={
<Switch
checked={brewSettings.ip}
value={'ip'}
onChange={handleCheckboxChange('ip')}
color="secondary"
margin
/>
}
label={<IntText text="BrewSettings.InvertPump" />}
/>
</div>
<Typography className={classes.formControl}><IntText text="BrewSettings.RestartAttention" /></Typography>
<TextValidator className={classes.formControl}
name="pri"
validators={['required']}
Expand Down Expand Up @@ -340,6 +354,24 @@ class BrewSettingsForm extends Component {
onChange={handleValueChange("ps")}
errorMessages={[<IntText text="FieldRequired" />]}
/>
<Typography className={classes.formControl} color="textSecondary"><IntText text="BrewSettings.PCFAddress" /></Typography>
<Select className={classes.formControl}
value={brewSettings.pa}
onChange={handleValueChange("pa")}
fullWidth
inputProps={{ required: true }}
>
<MenuItem value={0}><IntText text="0x20" /></MenuItem>
<MenuItem value={1}><IntText text="0x21" /></MenuItem>
<MenuItem value={2}><IntText text="0x22" /></MenuItem>
<MenuItem value={3}><IntText text="0x23" /></MenuItem>
<MenuItem value={4}><IntText text="0x24" /></MenuItem>
<MenuItem value={5}><IntText text="0x25" /></MenuItem>
<MenuItem value={6}><IntText text="0x26" /></MenuItem>
<MenuItem value={7}><IntText text="0x27" /></MenuItem>
<MenuItem value={8}><IntText text="0x38" /></MenuItem>
</Select>
<Typography className={classes.formControl}><IntText text="BrewSettings.RestartAttention" /></Typography>
</Paper>
</Grid>

Expand Down
5 changes: 4 additions & 1 deletion interface/src/language/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,10 @@
"PumpRestTime": "Pump Rest Time",
"PumpCycle": "Pump Cycle",
"EnableBoilKettle": "Enable Boil Kettle",
"BoilAttention": "Attention: enable only for systems with a separated boil kettle."
"BoilAttention": "Attention: enable only for systems with a separated boil kettle.",
"PCFAddress": "PCF Address",
"InvertPump": "Invert Pump",
"RestartAttention": "Attention: Save and restart the system to apply the change."
},
"WiFiSettings": {
"Settings": "WiFi Settings",
Expand Down
5 changes: 4 additions & 1 deletion interface/src/language/es-ES.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,10 @@
"PumpRestTime": "Tiempo descanso bomba",
"PumpCycle": "Ciclo de bomba",
"EnableBoilKettle": "Habilitar hervidor de agua",
"BoilAttention": "Attention: enable only for systems with a separated boil kettle."
"BoilAttention": "Attention: enable only for systems with a separated boil kettle.",
"PCFAddress": "PCF Address",
"InvertPump": "Invert Pump",
"RestartAttention": "Attention: Save and restart the system to apply the change."
},
"WiFiSettings": {
"Settings": "Configuración",
Expand Down
5 changes: 4 additions & 1 deletion interface/src/language/he-IL.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,10 @@
"PumpRestTime": "זמן מנוחת משאבה",
"PumpCycle": "מחזור משאבה",
"EnableBoilKettle": "אפשר סיר רתיחה",
"BoilAttention": "שימו לב: הפעילו רק במידה ויש לכם סיר רתיחה נפרד"
"BoilAttention": "שימו לב: הפעילו רק במידה ויש לכם סיר רתיחה נפרד",
"PCFAddress": "PCF Address",
"InvertPump": "Invert Pump",
"RestartAttention": "Attention: Save and restart the system to apply the change."
},
"WiFiSettings": {
"Settings": "תצורה רשת אלחוטית",
Expand Down
5 changes: 4 additions & 1 deletion interface/src/language/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,10 @@
"PumpRestTime": "Tempo de descanso da bomba",
"PumpCycle": "CICLO DA BOMBA",
"EnableBoilKettle": "Habilitar panela de fervura",
"BoilAttention": "Atenção: habilite apenas se a panela de fervura for independente."
"BoilAttention": "Atenção: habilite apenas se a panela de fervura for independente.",
"PCFAddress": "Endereço PCF",
"InvertPump": "Invert Pump",
"RestartAttention": "Atenção: Salve e reinicie o sistema para aplicar a alteração."
},
"WiFiSettings": {
"Settings": "WiFi - Definições",
Expand Down
5 changes: 4 additions & 1 deletion interface/src/language/ru-RU.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,10 @@
"PumpRestInterval": "Отдых насоса",
"PumpRestTime": "Время отдыха насоса",
"EnableBoilKettle": "Enable Boil Kettle",
"BoilAttention": "Attention: enable only for systems with a separated boil kettle."
"BoilAttention": "Attention: enable only for systems with a separated boil kettle.",
"PCFAddress": "PCF Address",
"InvertPump": "Invert Pump",
"RestartAttention": "Attention: Save and restart the system to apply the change."
},
"WiFiSettings": {
"Settings": "WiFi Settings",
Expand Down
5 changes: 3 additions & 2 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ build_flags=
-D BUTTONSTART_BUS=0
-D BUTTONENTER_BUS=1

-D INVERT_PUMP=false
-D PCF8574_ADDRESS=0x20

-D CORS_ORIGIN=\"http://localhost:3000\"
-D Debug=false
-D Version=\"1.0.15\"
-D Version=\"1.0.16\"
4 changes: 4 additions & 0 deletions src/BrewSettingsService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ void BrewSettingsService::readFromJsonObject(JsonObject &root)
BoilSensorOffset = root["bso"];
Language = root["lg"] | "";
TempUnit = root["tu"] | "";
InvertPump = root["ip"];
PCFAddress = root["pa"];
}

void BrewSettingsService::writeToJsonObject(JsonObject &root)
Expand Down Expand Up @@ -67,6 +69,8 @@ void BrewSettingsService::writeToJsonObject(JsonObject &root)
root["asoo"] = AuxSensorOneOffset;
root["asto"] = AuxSensorTwoOffset;
root["astho"] = AuxSensorThreeOffset;
root["ip"] = InvertPump;
root["pa"] = PCFAddress;
_activeStatus->PIDSettingsUpdated = true;
}

Expand Down
3 changes: 3 additions & 0 deletions src/BrewSettingsService.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ class BrewSettingsService : public SettingsService

int PumpRestInterval;
int PumpRestTime;
bool InvertPump;

int PCFAddress;

double MainSensorOffset;
double SpargeSensorOffset;
Expand Down
5 changes: 2 additions & 3 deletions src/Lcd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ Lcd::Lcd(ActiveStatus *activeStatus, WiFiStatus *wifiStatus, LiquidCrystal_I2C *

Lcd::~Lcd() {}

void Lcd::autoScan()
void Lcd::autoScan(uint8 pcfAddress)
{
byte error, address;
Serial.println("Scanning I2C bus...");
for (address = 1; address < 127; address++)
{
if (address == PCF8574_ADDRESS)
if (address == pcfAddress)
{
Serial.print("Found not display addr: ");
Serial.println(address, HEX);
Expand All @@ -50,7 +50,6 @@ void Lcd::autoScan()

void Lcd::begin()
{
autoScan();
_lcd->init();
_lcd->backlight();
_lcd->createChar(apmode_icon, apmode);
Expand Down
4 changes: 1 addition & 3 deletions src/Lcd.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
#include <WiFiStatus.h>
#include <APStatus.h>

#define PCF8574_ADDRESS 0x20

#define apmode_icon 1
#define stmode_icon 2
#define gpump_icon 3
Expand Down Expand Up @@ -39,6 +37,7 @@ class Lcd
~Lcd();
void update();
void begin();
void autoScan(uint8 pcfAddress);

private:
LiquidCrystal_I2C *_lcd;
Expand All @@ -57,7 +56,6 @@ class Lcd
bool sparge;
};

void autoScan();
void printHead();
void printFooter();
String GetCount(bool down);
Expand Down
4 changes: 2 additions & 2 deletions src/Pump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ void Pump::TurnPumpOff()

void Pump::TurnPump(bool on)
{
on = INVERT_PUMP ? !on : on;
on = _brewSettingsService->InvertPump ? !on : on;
digitalWrite(PUMP_BUS, on ? HIGH : LOW);
_activeStatus->PumpOn = INVERT_PUMP ? !on : on;
_activeStatus->PumpOn = _brewSettingsService->InvertPump ? !on : on;
}

void Pump::CheckRest()
Expand Down
32 changes: 31 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ int deviceCount = 0;
LiquidCrystal_I2C lcd_i2c(0x0, 20, 4);

TwoWire pcfWire;
PCF857x pcf8574(PCF8574_ADDRESS, &pcfWire);

AsyncWebServer server(80);

Expand All @@ -79,6 +78,33 @@ TemperatureService temperatureService = TemperatureService(&server, &SPIFFS, DS1
MashSettingsService mashSettings = MashSettingsService(&server, &SPIFFS);
BoilSettingsService boilSettingsService = BoilSettingsService(&server, &SPIFFS, &brewSettingsService);

uint8_t getPCFAddress()
{
SPIFFS.begin();
brewSettingsService.begin();
uint8_t pcfAddress = PCF8574_ADDRESS;
if (brewSettingsService.PCFAddress == 0)
pcfAddress = 0x20;
else if (brewSettingsService.PCFAddress == 1)
pcfAddress = 0x21;
else if (brewSettingsService.PCFAddress == 2)
pcfAddress = 0x22;
else if (brewSettingsService.PCFAddress == 3)
pcfAddress = 0x23;
else if (brewSettingsService.PCFAddress == 4)
pcfAddress = 0x24;
else if (brewSettingsService.PCFAddress == 5)
pcfAddress = 0x25;
else if (brewSettingsService.PCFAddress == 6)
pcfAddress = 0x26;
else if (brewSettingsService.PCFAddress == 7)
pcfAddress = 0x27;
else if (brewSettingsService.PCFAddress == 8)
pcfAddress = 0x38;

return pcfAddress;
}

Pump pump = Pump(&server, &activeStatus, &brewSettingsService);
Lcd lcd = Lcd(&activeStatus, &wifiStatus, &lcd_i2c);
MashKettleHeaterService mashKettleHeaterService = MashKettleHeaterService(&temperatureService, &activeStatus, &brewSettingsService);
Expand All @@ -88,6 +114,9 @@ MashService mashService = MashService(&SPIFFS, &temperatureService, &pump);
BoilService boilService = BoilService(&SPIFFS, &temperatureService, &brewSettingsService);
BrewService brewService = BrewService(&server, &SPIFFS, &mashService, &boilService, &brewSettingsService, &mashKettleHeaterService, &spargeKettleHeaterService, &boilKettleHeaterService, &activeStatus, &temperatureService, &pump, &lcd);

uint8_t pcfAddress = getPCFAddress();
PCF857x pcf8574(pcfAddress, &pcfWire);

time_t lastReadButton = now();
KeyButton button1(BUTTONUP_BUS, pcf8574);
KeyButton button2(BUTTONDOWN_BUS, pcf8574);
Expand Down Expand Up @@ -190,6 +219,7 @@ void setup()
temperatureService.DeviceCount = deviceCount;
brewSettingsService.begin();
brewService.begin();
lcd.autoScan(pcfAddress);
lcd.begin();

pcfWire.begin(D2, D1);
Expand Down

0 comments on commit a8bc1f2

Please sign in to comment.