Skip to content

Commit

Permalink
add wireless hydrometer information in log
Browse files Browse the repository at this point in the history
  • Loading branch information
vitotai committed Feb 8, 2024
1 parent 121aa46 commit 07498d3
Show file tree
Hide file tree
Showing 39 changed files with 33,047 additions and 32,732 deletions.
58 changes: 55 additions & 3 deletions src/BrewLogger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#if EnableHumidityControlSupport
#include "HumidityControl.h"
#endif
#include "ExternalData.h"

#define LoggingPeriod 60000 //in ms
#define MinimumGapToSync 600 // in seconds
Expand Down Expand Up @@ -859,8 +860,12 @@ BrewLogger::BrewLogger(void){
*ptr++ = (char) (_headTime >> 16);
*ptr++ = (char) (_headTime >> 8);
*ptr++ = (char) (_headTime & 0xFF); //8
// insert two bytes
*ptr++ = 1; // length
*ptr++ = theSettings.GravityConfig()->gravityDeviceType;

// a record full of all data = 2 + 7 * 2= 16
*ptr++ = (char) PeriodTag; //9
*ptr++ = (char) PeriodTag; //9 +2 ..
*ptr++ = (char) 0x7F; //10
for(int i=0;i<VolatileDataHeaderSize;i++){ // 10 + VolatileDataHeaderSize *2
*ptr++ = _headData[i] >> 8;
Expand Down Expand Up @@ -909,12 +914,59 @@ BrewLogger::BrewLogger(void){
*ptr++ = (char) (_pFileInfo->starttime >> 16);
*ptr++ = (char) (_pFileInfo->starttime >> 8);
*ptr++ = (char) (_pFileInfo->starttime & 0xFF);

// from V7, reserve a block for gravity device data
// starting from length of this block
// followed by the device type
// more information like names to be come
// b0: length of whole block
// b1 gravity device type
// TLV: type, length, value
GravityDeviceConfiguration *gdCfg=theSettings.GravityConfig();
if(gdCfg->gravityDeviceType == GravityDeviceIspindel){
// length is ??
const char *name = externalData.getDeviceName();
if(name){
uint8_t length =(uint8_t) strlen(name);
*ptr++ = 3 + length;
*ptr++ = GravityDeviceIspindel;

*ptr++ = GDIIdentity;
*ptr++ = length;
for(uint8_t n=0;n<length;n++){
*ptr++ = name[n];
}
}else{
*ptr++ = 1;
*ptr++ = GravityDeviceIspindel;
}

}else if(gdCfg->gravityDeviceType == GravityDeviceTilt){
// total length:
*ptr++ = 4;
*ptr++ = GravityDeviceTilt; //1
*ptr++ = GDIIdentity;
*ptr++ = 1;
*ptr++ = theSettings.tiltConfiguration()->tiltColor;
}else if(gdCfg->gravityDeviceType == GravityDevicePill){
*ptr++ = 9;
*ptr++ = GravityDevicePill; //1
*ptr++ = GDIAddress;
*ptr++ = 6;
uint8_t *mac =theSettings.pillConfiguration()->macAddress;
for(int m=0;m<6;m++){
*ptr++ =mac[m];
}
}else{
// no device
*ptr++ = 1; // length
*ptr++ = GravityDeviceNone; // no device
}
_logIndex=0;
_savedLength=0;

_commitData(_logIndex,ptr - _logBuffer );

//DBG_PRINTF("*_startLog*\n");
}
void BrewLogger::_startVolatileLog(void)
{
Expand Down Expand Up @@ -1238,7 +1290,7 @@ BrewLogger::BrewLogger(void){
size_t gap=rtime - _pFileInfo->starttime;
if(rtime < 1545211593L || gap > 60*60*24*30){
// something wrong. just give it a minute, relying on following TimeSync Tag
DBG_PRINTF("abnormal resume, start:%lu, current:%u gap:%u\n",_pFileInfo->starttime,rtime,gap);
DBG_PRINTF("abnormal resume, start:%lu, current:%u gap:%u\n",_pFileInfo->starttime,rtime,gap);
gap =60;
rtime = _pFileInfo->starttime + gap;
}
Expand Down
7 changes: 5 additions & 2 deletions src/BrewLogger.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,14 @@
#define INVALID_TEMP_INT 0x7FFF
#define INVALID_GRAVITY_INT 0x7FFF

#define GDIAddress 1
#define GDIIdentity 2

#define VolatileDataHeaderSize 7
#if EnableHumidityControlSupport
#define VolatileHeaderSize ( VolatileDataHeaderSize*2 + 18)
#define VolatileHeaderSize ( VolatileDataHeaderSize*2 + 20)
#else
#define VolatileHeaderSize ( VolatileDataHeaderSize*2 + 16)
#define VolatileHeaderSize ( VolatileDataHeaderSize*2 + 18)
#endif

#define OrderBeerSet 0
Expand Down
15 changes: 14 additions & 1 deletion src/ExternalData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ void ExternalData::gravityDeviceSetting(char *buf){
doc["plato"] = _cfg->usePlato;

doc["fpt"] = _cfg->numCalPoints;
doc["name"] = (_ispindelName)? _ispindelName:"Unknown";
doc["name"] = getDeviceName();

buf[0]='G';
buf[1]=':';
Expand Down Expand Up @@ -454,3 +454,16 @@ void ExternalData::_deriveFormula(void){
DBG_PRINTF("\n");
}
}


const char* ExternalData::getDeviceName(void){
if(_cfg->gravityDeviceType == GravityDeviceIspindel){
return (_ispindelName)? _ispindelName:"iSpindel";
}else if(_cfg->gravityDeviceType == GravityDeviceTilt){
return "Tilt";
}else if(_cfg->gravityDeviceType == GravityDevicePill){
return "Pill";
}else{
return "unkown";
}
}
2 changes: 2 additions & 0 deletions src/ExternalData.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ class ExternalData

// data from
void setWaterTiltGravity(float tilt,float sg);

const char* getDeviceName(void);
};

extern ExternalData externalData;
Expand Down
1,642 changes: 821 additions & 821 deletions wdoc/chinese_config_htm.h

Large diffs are not rendered by default.

1,673 changes: 842 additions & 831 deletions wdoc/chinese_gdc_e32_htm.h

Large diffs are not rendered by default.

1,049 changes: 530 additions & 519 deletions wdoc/chinese_gdc_htm.h

Large diffs are not rendered by default.

5,639 changes: 2,826 additions & 2,813 deletions wdoc/chinese_index_htm.h

Large diffs are not rendered by default.

720 changes: 360 additions & 360 deletions wdoc/chinese_pressure_htm.h

Large diffs are not rendered by default.

1,184 changes: 592 additions & 592 deletions wdoc/english_config_htm.h

Large diffs are not rendered by default.

1,621 changes: 816 additions & 805 deletions wdoc/english_gdc_e32_htm.h

Large diffs are not rendered by default.

1,578 changes: 795 additions & 783 deletions wdoc/english_gdc_htm.h

Large diffs are not rendered by default.

2,736 changes: 1,375 additions & 1,361 deletions wdoc/english_index_htm.h

Large diffs are not rendered by default.

908 changes: 454 additions & 454 deletions wdoc/english_pressure_htm.h

Large diffs are not rendered by default.

1,192 changes: 596 additions & 596 deletions wdoc/italian_config_htm.h

Large diffs are not rendered by default.

1,587 changes: 799 additions & 788 deletions wdoc/italian_gdc_e32_htm.h

Large diffs are not rendered by default.

1,583 changes: 797 additions & 786 deletions wdoc/italian_gdc_htm.h

Large diffs are not rendered by default.

5,605 changes: 2,809 additions & 2,796 deletions wdoc/italian_index_htm.h

Large diffs are not rendered by default.

704 changes: 352 additions & 352 deletions wdoc/italian_pressure_htm.h

Large diffs are not rendered by default.

1,192 changes: 596 additions & 596 deletions wdoc/norwegian_config_htm.h

Large diffs are not rendered by default.

1,139 changes: 575 additions & 564 deletions wdoc/norwegian_gdc_e32_htm.h

Large diffs are not rendered by default.

1,553 changes: 782 additions & 771 deletions wdoc/norwegian_gdc_htm.h

Large diffs are not rendered by default.

5,602 changes: 2,807 additions & 2,795 deletions wdoc/norwegian_index_htm.h

Large diffs are not rendered by default.

928 changes: 464 additions & 464 deletions wdoc/norwegian_pressure_htm.h

Large diffs are not rendered by default.

1,200 changes: 600 additions & 600 deletions wdoc/portuguese-br_config_htm.h

Large diffs are not rendered by default.

1,621 changes: 816 additions & 805 deletions wdoc/portuguese-br_gdc_e32_htm.h

Large diffs are not rendered by default.

1,079 changes: 545 additions & 534 deletions wdoc/portuguese-br_gdc_htm.h

Large diffs are not rendered by default.

2,785 changes: 1,399 additions & 1,386 deletions wdoc/portuguese-br_index_htm.h

Large diffs are not rendered by default.

710 changes: 355 additions & 355 deletions wdoc/portuguese-br_pressure_htm.h

Large diffs are not rendered by default.

1,786 changes: 893 additions & 893 deletions wdoc/slovak_config_htm.h

Large diffs are not rendered by default.

1,139 changes: 575 additions & 564 deletions wdoc/slovak_gdc_e32_htm.h

Large diffs are not rendered by default.

1,585 changes: 798 additions & 787 deletions wdoc/slovak_gdc_htm.h

Large diffs are not rendered by default.

2,811 changes: 1,412 additions & 1,399 deletions wdoc/slovak_index_htm.h

Large diffs are not rendered by default.

712 changes: 356 additions & 356 deletions wdoc/slovak_pressure_htm.h

Large diffs are not rendered by default.

1,202 changes: 601 additions & 601 deletions wdoc/spanish_config_htm.h

Large diffs are not rendered by default.

1,145 changes: 578 additions & 567 deletions wdoc/spanish_gdc_e32_htm.h

Large diffs are not rendered by default.

1,561 changes: 786 additions & 775 deletions wdoc/spanish_gdc_htm.h

Large diffs are not rendered by default.

5,610 changes: 2,811 additions & 2,799 deletions wdoc/spanish_index_htm.h

Large diffs are not rendered by default.

916 changes: 458 additions & 458 deletions wdoc/spanish_pressure_htm.h

Large diffs are not rendered by default.

0 comments on commit 07498d3

Please sign in to comment.