Skip to content

Commit

Permalink
Merge pull request #141 from visualapproach/development
Browse files Browse the repository at this point in the history
  • Loading branch information
visualapproach authored Nov 3, 2021
2 parents a0ff594 + 01e112a commit 24cba89
Show file tree
Hide file tree
Showing 8 changed files with 145 additions and 95 deletions.
47 changes: 12 additions & 35 deletions Code/4-wire-version/lib/BWC4W/BWC_8266_4w_globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,18 +112,6 @@ const uint8_t POWERBITMASK = B10000000; //128
#endif

#ifdef NO54138
// /*combination matrix
// Heater1 Heater2 Bubbles Jets Pump
// H1 - 1 0 0 1
// H2 - 0 0 1
// B - 0 0
// J - 0
// P
// ten boolean values above stored in a word "comb_matrix"
// Heater and pump values are still partly hardcoded in combination with the heatbitmasks.
// Do not change the heatbitmasks below unless you really know what you are doing.
// */
// const uint16_t COMB_MATRIX = 0x248; // B0000001001001000;

//what row in allowedstates to go to when pressing Bubbles, Jets, Pump, Heat (columns in that order)
//Example: We are in state zero (first row). If we press Bubbles (first column) then there is a 6
Expand All @@ -138,11 +126,11 @@ const uint8_t JUMPTABLE[][4] = {
};
//Bubbles, Jets, Pump, Heat
const uint8_t ALLOWEDSTATES[][4] = {
{0,0,0,0}, //the "2" means both heater elements
{0,0,0,0},
{1,0,0,0},
{0,1,0,0},
{0,0,1,0},
{0,0,1,2}
{0,0,1,2} //the "2" means both heater elements
};

//cio
Expand All @@ -158,26 +146,17 @@ const uint8_t PAYLOADSIZE = 7;
const uint8_t PUMPBITMASK = B00000101; //5
const uint8_t BUBBLESBITMASK = B00000010; //2
const uint8_t JETSBITMASK = B00001000; //8
const uint8_t HEATBITMASK1 = B00000000; //0 heater stage 1 = off **DO NOT CHANGE WITHOUT CHANGING .cpp**
const uint8_t HEATBITMASK1 = B00000000; //0 heater stage 1 = off
const uint8_t HEATBITMASK2 = B00110000; //48 heater stage 2 = on
//lines below should be tested. It would be consistent with 54173 model.
//If heating is slow this is probably the cause but I don't want to change it before someone tests it.
//const uint8_t HEATBITMASK1 = B00110000; //48 heater stage 1 = 50%
//const uint8_t HEATBITMASK2 = B01000000; //64 heater stage 2 = 100%
const uint8_t POWERBITMASK = B10000000; //128
#endif

#ifdef NO54123
//WARNING: THIS DEVICE HAS DIFFERENT PINOUTS!!! CHECK BEFORE USING
//NOT TESTED BY ME!!
// /*combination matrix
// Heater1 Heater2 Bubbles Jets Pump
// H1 - 1 0 0 1
// H2 - 0 0 1
// B - 0 0
// J - 0
// P
// ten boolean values above stored in a word "comb_matrix"
// Heater and pump values are still partly hardcoded in combination with the heatbitmasks.
// Do not change the heatbitmasks below unless you really know what you are doing.
// */
// const uint16_t COMB_MATRIX = 0x248; // B0000001001001000;

//what row in allowedstates to go to when pressing Bubbles, Jets, Pump, Heat (columns in that order)
//Example: We are in state zero (first row). If we press Bubbles (first column) then there is a 6
Expand All @@ -192,11 +171,11 @@ const uint8_t JUMPTABLE[][4] = {
};
//Bubbles, Jets, Pump, Heat
const uint8_t ALLOWEDSTATES[][4] = {
{0,0,0,0}, //the "2" means both heater elements
{0,0,0,0},
{1,0,0,0},
{0,1,0,0},
{0,0,1,0},
{0,0,1,2}
{0,0,1,2} //the "2" means both heater elements
};

//cio
Expand All @@ -209,13 +188,11 @@ const uint8_t DSP_CHECKSUMINDEX = 5;

const uint8_t PAYLOADSIZE = 7;

//following is how I interpret the slides. (LSB = bit0)
//It may very well be the opposite (MSB = bit0)
const uint8_t PUMPBITMASK = B00010000; // 1 << 4;
const uint8_t PUMPBITMASK = B00010000; //1 << 4;
const uint8_t BUBBLESBITMASK = B00100000; //1 << 5;
const uint8_t JETSBITMASK = B00000000; //0; //no jets on this machine.
const uint8_t HEATBITMASK1 = B00000000; //(1 << 1) | (1 << 3); this is the "stage 1" setting (no heat) **DO NOT CHANGE WITHOUT CHANGING .cpp**
const uint8_t HEATBITMASK2 = B00001010; //0; I don't know if there is one or more heater elements, so this is the "stage 2" setting
const uint8_t HEATBITMASK1 = B00000010; //(1 << 1) "stage 1"
const uint8_t HEATBITMASK2 = B00001000; //(1 << 3) "stage 2" (thanks @dietmar-1 for testing and reporting this)
const uint8_t POWERBITMASK = B00000001; //1;
#endif

Expand Down
23 changes: 23 additions & 0 deletions Code/6-wire-version/data/WebSocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const resettimes = 8;
const resetcltimer = 9;
const resetftimer = 10;
const setjets = 11;
const setbrightness = 12;

connect();

Expand Down Expand Up @@ -136,6 +137,8 @@ function handlemsg(e) {
document.getElementById('temp').max = 104;
}
document.getElementById('dsp').innerHTML = "[" + String.fromCharCode(msgobj.CH1,msgobj.CH2,msgobj.CH3)+ "]";
document.getElementById('brt').value = msgobj.BRT;
document.getElementById("dsp").style.color = rgb((parseInt(msgobj.BRT)+1) * 255/8, 0, 0);
}
if(msgobj.CONTENT == "TIMES"){
var date = new Date(msgobj.TIME * 1000);
Expand Down Expand Up @@ -165,6 +168,7 @@ function handlemsg(e) {
document.getElementById('filtertime').innerHTML = s2dhms(msgobj.PUMPTIME);
document.getElementById('jettime').innerHTML = s2dhms(msgobj.JETTIME);
document.getElementById('cost').innerHTML = (msgobj.COST).toFixed(2);
document.getElementById('tttt').innerHTML = (msgobj.TTTT/3600).toFixed(2) + "h<br>(" + new Date(msgobj.TIME * 1000 + msgobj.TTTT * 1000).toLocaleString() + ")";
}

};
Expand Down Expand Up @@ -246,6 +250,25 @@ function sliderchange(){
document.getElementById("sliderlabel").innerHTML = document.getElementById('temp').value.toString();
}

function brtchange(){
var v = document.getElementById('brt').value;
document.getElementById("dsp").style.color = rgb((parseInt(v)+1) * 255/8, 0, 0);
var sendobj = {};
sendobj["CMD"] = setbrightness;
sendobj["VALUE"] = v;
sendobj["XTIME"] = 0;
sendobj["INTERVAL"] = 0;
connection.send(JSON.stringify(sendobj));
console.log(JSON.stringify(sendobj));
}

function rgb(r, g, b){
r = Math.floor(r);
g = Math.floor(g);
b = Math.floor(b);
return ["rgb(",r,",",g,",",b,")"].join("");
}

function clTimer() {
var sendobj = {};
sendobj["CMD"] = resetcltimer;
Expand Down
6 changes: 5 additions & 1 deletion Code/6-wire-version/data/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ <h3 id="tt"> Target temp: <label id="ttlabel" for="tt">0</label></h3>
<tr>
<td style="width:30%"><h4 id="mqtt">MQTT</h4></td>
<td style="width:20%"><h2 id="dsp" style="text-align: center; background-color: #000; color: red">display</h2></td>
<td style="width:30%"></td>
<td style="width:30%"><input class="enabled" id="brt" type="range" min="0" max="7" step="1" value="7" onmouseup="brtchange()" ontouchend="brtchange()" oninput="brtchange()"></td>
</tr>
</table>
</div>
Expand Down Expand Up @@ -142,6 +142,10 @@ <h3 id="tt"> Target temp: <label id="ttlabel" for="tt">0</label></h3>
<td style="width:20%; white-space:nowrap">Estimated cost: </td>
<td style="width:70%; white-space:nowrap; text-align:left" id="cost">00:00:00</td>
</tr>
<tr>
<td style="width:20%; white-space:nowrap">Est. time to target temp.: </td>
<td style="width:70%; white-space:nowrap; text-align:left" id="tttt">00:00:00</td>
</tr>
<tr>
<td></td>
<td>
Expand Down
Loading

0 comments on commit 24cba89

Please sign in to comment.