Merge remote-tracking branch 'remotes/origin/JCWebColorChangeBar'
Resolved Conflicts in : Arduino/BTCDieselHeater/BTCDieselHeater.ino Arduino/BTCDieselHeater/src/WiFi/mainpage.cpp
This commit is contained in:
commit
6a3e57ca11
|
@ -133,7 +133,7 @@ void checkDisplayUpdate();
|
||||||
void checkDebugCommands();
|
void checkDebugCommands();
|
||||||
|
|
||||||
// DS18B20 temperature sensor support
|
// DS18B20 temperature sensor support
|
||||||
OneWire ds(DS18B20_Pin); // on pin 5 (a 4.7K resistor is necessary)
|
OneWire ds(15); // on pin 5 (a 4.7K resistor is necessary)
|
||||||
DallasTemperature TempSensor(&ds);
|
DallasTemperature TempSensor(&ds);
|
||||||
long lastTemperatureTime; // used to moderate DS18B20 access
|
long lastTemperatureTime; // used to moderate DS18B20 access
|
||||||
float fFilteredTemperature = -100; // -100: force direct update uopn first pass
|
float fFilteredTemperature = -100; // -100: force direct update uopn first pass
|
||||||
|
@ -233,13 +233,27 @@ void parentKeyHandler(uint8_t event)
|
||||||
ScreenManager.keyHandler(event); // call into the Screen Manager
|
ScreenManager.keyHandler(event); // call into the Screen Manager
|
||||||
}
|
}
|
||||||
|
|
||||||
void setup() {
|
// Added additional t
|
||||||
|
|
||||||
|
int numberOfDevices; // Number of temperature devices found
|
||||||
|
DeviceAddress tempDeviceAddress;
|
||||||
|
|
||||||
|
void printAddress(DeviceAddress deviceAddress)
|
||||||
|
{
|
||||||
|
for (uint8_t i = 0; i < 8; i++)
|
||||||
|
{
|
||||||
|
if (deviceAddress[i] < 16) DebugPort.print("0");
|
||||||
|
DebugPort.print(deviceAddress[i], HEX);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void setup() {
|
||||||
|
TempSensor.begin();
|
||||||
|
DebugPort.print("Temperature for the device 1 (index 0) is: ");
|
||||||
|
DebugPort.println(TempSensor.getTempCByIndex(0));
|
||||||
// initialise TelnetSpy (port 23) as well as Serial to 115200
|
// initialise TelnetSpy (port 23) as well as Serial to 115200
|
||||||
// Serial is the usual USB connection to a PC
|
// Serial is the usual USB connection to a PC
|
||||||
// DO THIS BEFORE WE TRY AND SEND DEBUG INFO!
|
// DO THIS BEFORE WE TRY AND SEND DEBUG INFO!
|
||||||
|
|
||||||
TempSensor.begin();
|
|
||||||
DebugPort.setWelcomeMsg("*************************************************\r\n"
|
DebugPort.setWelcomeMsg("*************************************************\r\n"
|
||||||
"* Connected to BTC heater controller debug port *\r\n"
|
"* Connected to BTC heater controller debug port *\r\n"
|
||||||
"*************************************************\r\n");
|
"*************************************************\r\n");
|
||||||
|
@ -257,8 +271,45 @@ void setup() {
|
||||||
Clock.begin();
|
Clock.begin();
|
||||||
|
|
||||||
// initialise DS18B20 temperature sensor(s)
|
// initialise DS18B20 temperature sensor(s)
|
||||||
TempSensor.setWaitForConversion(false);
|
// Grab a count of devices on the wire
|
||||||
TempSensor.requestTemperatures();
|
numberOfDevices = TempSensor.getDeviceCount();
|
||||||
|
|
||||||
|
// locate devices on the bus
|
||||||
|
DebugPort.print("Locating devices...");
|
||||||
|
|
||||||
|
DebugPort.print("Found ");
|
||||||
|
DebugPort.print(numberOfDevices, DEC);
|
||||||
|
DebugPort.println(" devices.");
|
||||||
|
|
||||||
|
// report parasite power requirements
|
||||||
|
DebugPort.print("Parasite power is: ");
|
||||||
|
if (TempSensor.isParasitePowerMode()) Serial.println("ON");
|
||||||
|
else DebugPort.println("OFF");
|
||||||
|
|
||||||
|
// Loop through each device, print out address
|
||||||
|
for(int i=0;i<numberOfDevices; i++)
|
||||||
|
{
|
||||||
|
// Search the wire for address
|
||||||
|
if(TempSensor.getAddress(tempDeviceAddress, i))
|
||||||
|
{
|
||||||
|
DebugPort.print("Found device ");
|
||||||
|
DebugPort.print(i, DEC);
|
||||||
|
DebugPort.print(" with address: ");
|
||||||
|
printAddress(tempDeviceAddress);
|
||||||
|
DebugPort.println();
|
||||||
|
|
||||||
|
|
||||||
|
DebugPort.print("Resolution actually set to: ");
|
||||||
|
DebugPort.print(TempSensor.getResolution(tempDeviceAddress), DEC);
|
||||||
|
DebugPort.println();
|
||||||
|
}else{
|
||||||
|
DebugPort.print("Found ghost device at ");
|
||||||
|
DebugPort.print(i, DEC);
|
||||||
|
DebugPort.print(" but could not detect address. Check power and cabling");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// TempSensor.setWaitForConversion(false);
|
||||||
|
// TempSensor.requestTemperatures();
|
||||||
lastTemperatureTime = millis();
|
lastTemperatureTime = millis();
|
||||||
lastAnimationTime = millis();
|
lastAnimationTime = millis();
|
||||||
|
|
||||||
|
@ -431,7 +482,6 @@ void loop()
|
||||||
// Skip state machine immediately to BTC_Tx, sending our own settings.
|
// Skip state machine immediately to BTC_Tx, sending our own settings.
|
||||||
bHasHtrData = false;
|
bHasHtrData = false;
|
||||||
bHasOEMController = false;
|
bHasOEMController = false;
|
||||||
bHasHtrData = false;
|
|
||||||
bool isBTCmaster = true;
|
bool isBTCmaster = true;
|
||||||
TxManage.PrepareFrame(DefaultBTCParams, isBTCmaster); // use our parameters, and mix in NV storage values
|
TxManage.PrepareFrame(DefaultBTCParams, isBTCmaster); // use our parameters, and mix in NV storage values
|
||||||
TxManage.Start(timenow);
|
TxManage.Start(timenow);
|
||||||
|
@ -664,7 +714,11 @@ void loop()
|
||||||
fFilteredTemperature = -100;
|
fFilteredTemperature = -100;
|
||||||
}
|
}
|
||||||
DefaultBTCParams.setTemperature_Actual((unsigned char)(fFilteredTemperature + 0.5)); // update [BTC] frame to send
|
DefaultBTCParams.setTemperature_Actual((unsigned char)(fFilteredTemperature + 0.5)); // update [BTC] frame to send
|
||||||
|
// Added DISABLE INTERRUPTS to test for parasitic fix.
|
||||||
|
portDISABLE_INTERRUPTS();
|
||||||
TempSensor.requestTemperatures(); // prep sensor for future reading
|
TempSensor.requestTemperatures(); // prep sensor for future reading
|
||||||
|
portENABLE_INTERRUPTS();
|
||||||
|
|
||||||
ScreenManager.reqUpdate();
|
ScreenManager.reqUpdate();
|
||||||
}
|
}
|
||||||
updateJSONclients(bReportJSONData);
|
updateJSONclients(bReportJSONData);
|
||||||
|
|
|
@ -108,6 +108,17 @@ const char* MAIN_PAGE PROGMEM = R"=====(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setSchedule(){
|
||||||
|
//clearly need to add some code here to send the Json formatted data to the esp
|
||||||
|
console.log("Set Schedule Button Press")
|
||||||
|
}
|
||||||
|
|
||||||
|
Date.prototype.toDateInputValue = (function() {
|
||||||
|
var local = new Date(this);
|
||||||
|
local.setMinutes(this.getMinutes() - this.getTimezoneOffset());
|
||||||
|
return local.toJSON().slice(0,10);
|
||||||
|
});
|
||||||
|
|
||||||
function sendJSONobject(obj){
|
function sendJSONobject(obj){
|
||||||
var str = JSON.stringify(obj);
|
var str = JSON.stringify(obj);
|
||||||
console.log("JSON Tx:", str);
|
console.log("JSON Tx:", str);
|
||||||
|
@ -136,110 +147,6 @@ function setcurrentdate(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Date Picker Script
|
|
||||||
|
|
||||||
window.onload = function() {
|
|
||||||
// IE11 forEach, padStart
|
|
||||||
(function () {
|
|
||||||
if ( typeof NodeList.prototype.forEach === "function" ) return false;
|
|
||||||
NodeList.prototype.forEach = Array.prototype.forEach;
|
|
||||||
})();
|
|
||||||
|
|
||||||
(function () {
|
|
||||||
if ( typeof String.prototype.padStart === "function" ) return false;
|
|
||||||
String.prototype.padStart = function padStart(length, value) {
|
|
||||||
var res = String(this);
|
|
||||||
if(length >= (value.length + this.length)) {
|
|
||||||
for (var i = 0; i <= (length - (value.length + this.length)); i++) {
|
|
||||||
res = value + res;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return res;
|
|
||||||
};
|
|
||||||
})();
|
|
||||||
|
|
||||||
var datePickerTpl = '<div class="yearMonth"><a class="previous">‹</a><span class="year">{y}</span>-<span class="month">{m}</span><a class="next">›</a></div><div class="days"><a>1</a><a>2</a><a>3</a><a>4</a><a>5</a><a>6</a><a>7</a><a>8</a><a>9</a><a>10</a><a>11</a><a>12</a><a>13</a><a>14</a><a>15</a><a>16</a><a>17</a><a>18</a><a>19</a><a>20</a><a>21</a><a>22</a><a>23</a><a>24</a><a>25</a><a>26</a><a>27</a><a>28</a><a>29</a><a>30</a><a>31</a>';
|
|
||||||
|
|
||||||
function daysInMonth(month, year) {
|
|
||||||
return new Date(year, month, 0).getDate();
|
|
||||||
}
|
|
||||||
|
|
||||||
function hideInvalidDays(dp, month, year){
|
|
||||||
dp.querySelectorAll(".days a").forEach(function(a){
|
|
||||||
a.style.display = "inline-block";
|
|
||||||
});
|
|
||||||
var days = daysInMonth(month, year);
|
|
||||||
var invalidCount = 31 - days;
|
|
||||||
if(invalidCount > 0) {
|
|
||||||
for (var j = 1; j <= invalidCount; j++) {
|
|
||||||
dp.querySelector(".days a:nth-last-child(" + j + ")").style.display = "none";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function clearSelected(dp) {
|
|
||||||
dp.querySelectorAll(".days a.selected").forEach(function(e){
|
|
||||||
e.classList.remove("selected");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function setMonthYear(dp, month, year, input) {
|
|
||||||
dp.querySelector(".month").textContent = String(month).padStart(2, "0");
|
|
||||||
dp.querySelector(".year").textContent = year;
|
|
||||||
clearSelected(dp);
|
|
||||||
hideInvalidDays(dp, month, year);
|
|
||||||
if(input && input.value) {
|
|
||||||
var date = input.value.split("-");
|
|
||||||
var curYear = parseInt(dp.querySelector(".year").textContent), curMonth = parseInt(dp.querySelector(".month").textContent);
|
|
||||||
if(date[0] == curYear && date[1] == curMonth) {
|
|
||||||
dp.querySelector(".days a:nth-child(" + parseInt(date[2]) + ")").className = "selected";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
document.querySelectorAll(".datepicker").forEach(function(input) {
|
|
||||||
input.setAttribute("readonly", "true");
|
|
||||||
var dp = document.createElement("div");
|
|
||||||
dp.className = "contextmenu";
|
|
||||||
dp.style.left = input.offsetLeft + "px";
|
|
||||||
dp.style.top = input.offsetTop + input.offsetHeight + "px";
|
|
||||||
var now = new Date();
|
|
||||||
dp.insertAdjacentHTML('beforeEnd', datePickerTpl.replace("{m}", String(now.getMonth() + 1).padStart(2, "0")).replace("{y}", now.getFullYear()));
|
|
||||||
hideInvalidDays(dp, now.getMonth() + 1, now.getFullYear());
|
|
||||||
|
|
||||||
dp.querySelector("a.previous").addEventListener("click", function(e){
|
|
||||||
var curYear = parseInt(dp.querySelector(".year").textContent), curMonth = parseInt(dp.querySelector(".month").textContent);
|
|
||||||
var firstMonth = curMonth - 1 == 0;
|
|
||||||
setMonthYear(dp, firstMonth ? 12 : curMonth - 1, firstMonth ? curYear - 1 : curYear, input);
|
|
||||||
});
|
|
||||||
|
|
||||||
dp.querySelector("a.next").addEventListener("click", function(e){
|
|
||||||
var curYear = parseInt(dp.querySelector(".year").textContent), curMonth = parseInt(dp.querySelector(".month").textContent);
|
|
||||||
var lastMonth = curMonth + 1 == 13;
|
|
||||||
setMonthYear(dp, lastMonth ? 1 : curMonth + 1, lastMonth ? curYear + 1 : curYear, input);
|
|
||||||
});
|
|
||||||
|
|
||||||
dp.querySelectorAll(".days a").forEach(function(a){
|
|
||||||
a.addEventListener("click", function(e) {
|
|
||||||
clearSelected(dp);
|
|
||||||
e.target.className = "selected";
|
|
||||||
input.value = dp.querySelector(".year").textContent + "-" + dp.querySelector(".month").textContent + "-" + this.text.padStart(2, "0");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
input.parentNode.insertBefore(dp, input.nextSibling);
|
|
||||||
|
|
||||||
input.addEventListener("focus", function(){
|
|
||||||
if (input.value){
|
|
||||||
var date = input.value.split("-");
|
|
||||||
setMonthYear(dp, date[1], date[0]);
|
|
||||||
dp.querySelector(".days a:nth-child(" + parseInt(date[2]) + ")").className = "selected";
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
// End date Picker Script
|
|
||||||
|
|
||||||
function funcNavLinks() {
|
function funcNavLinks() {
|
||||||
var x = document.getElementById("myLinks");
|
var x = document.getElementById("myLinks");
|
||||||
if (x.style.display === "block") {
|
if (x.style.display === "block") {
|
||||||
|
@ -277,6 +184,9 @@ function funcdispSettings() {
|
||||||
document.getElementById("Home").style.display = "none";
|
document.getElementById("Home").style.display = "none";
|
||||||
document.getElementById("Advanced").style.display = "none";
|
document.getElementById("Advanced").style.display = "none";
|
||||||
document.getElementById("myLinks").style.display ="none";
|
document.getElementById("myLinks").style.display ="none";
|
||||||
|
document.getElementById('curdate').valueAsDate = new Date();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function funcdispHome(){
|
function funcdispHome(){
|
||||||
|
@ -601,14 +511,17 @@ Advanced Settings
|
||||||
|
|
||||||
<Div id="Settings">
|
<Div id="Settings">
|
||||||
Current Date:<br>
|
Current Date:<br>
|
||||||
<input type="text" id="curdate"><input type="button" Value="Set Date" onclick="setcurrentdate()">
|
<input type="date" id="curdate"><input type="button" Value="Set Date" onclick="setcurrentdate()">
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
Current Time (24 Hour Format):<br>
|
Current Time (24 Hour Format):<br>
|
||||||
<input type="text" id="curtime"> <input type="button" Value="Set Time" onclick="setcurrenttime()">
|
<input type="time" id="curtime"> <input type="button" Value="Set Time" onclick="setcurrenttime()">
|
||||||
|
|
||||||
<hr></hr>
|
<hr></hr>
|
||||||
<br><br>
|
<br><br>
|
||||||
|
Timer1: <input type="checkbox" border-radius="4px" name="Timer1" id="Timer1onoff"> <input type="text" class="schedule" id="Timer1Start"> <input type="text" id="Timer1End"> <br>
|
||||||
|
Timer2: <input type="checkbox" border-radius="4px" name="Tue"> <input type="text" class="schedule" id="Timer2Start"> <input type="text" id="Timer2End"><br>
|
||||||
|
<input type="button" Value="Save Schedule" onclick="setSchedule()">
|
||||||
</Div>
|
</Div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in a new issue