Initial mode IP1 ON, IP2 OFF - works!

This commit is contained in:
rljonesau 2019-04-06 21:45:25 +11:00
parent 708a8087b1
commit e281e1adf8
7 changed files with 102 additions and 34 deletions

View file

@ -101,6 +101,7 @@
#include "src/Utility/DebugPort.h"
#include "src/Utility/UtilClasses.h"
#include "src/Utility/BTC_JSON.h"
#include "src/Utility/GPIO.h"
#include "src/OLED/ScreenManager.h"
#include "src/OLED/keypad.h"
#include <DallasTemperature.h>
@ -156,6 +157,7 @@ CSmartError SmartError;
CKeyPad KeyPad;
CScreenManager ScreenManager;
TelnetSpy DebugPort;
CGPIOin GPIOin;
sRxLine PCline;
long lastRxTime; // used to observe inter character delays
@ -408,6 +410,7 @@ void setup() {
bBTconnected = false;
Bluetooth.begin();
GPIOin.begin(GPIOin1_pin, GPIOin2_pin, GPIOinOn1Off2);
}
@ -442,6 +445,8 @@ void loop()
Bluetooth.check(); // check for Bluetooth activity
GPIOin.manageGPIO();
// manage changes in Bluetooth connection status
if(Bluetooth.isConnected()) {
if(!bBTconnected) {

View file

@ -271,39 +271,37 @@ CBasicScreen::showRunState()
static bool toggle = false;
const char* toPrint = NULL;
_display.setTextColor(WHITE, BLACK);
// if(runstate >= 0 && runstate <= 8) {
if(errstate && ((runstate == 0) || (runstate > 5))) {
// flash error code
char msg[16];
toggle = !toggle;
if(toggle) {
// create an "E-XX" message to display
sprintf(msg, "E-%02d", errstate);
}
else {
strcpy(msg, " ");
}
int xPos = _display.xCentre();
int yPos = _display.height() - 2*_display.textHeight();
_printMenuText(xPos, yPos, msg, false, eCentreJustify);
toPrint = getHeaterInfo().getErrStateStr();
// flash error code
char msg[16];
toggle = !toggle;
if(toggle) {
// create an "E-XX" message to display
sprintf(msg, "E-%02d", errstate);
}
else {
if(runstate) {
toPrint = getHeaterInfo().getRunStateStr();
// simplify starting states
switch(runstate) {
case 1:
case 2:
case 3:
case 4:
toPrint = "Starting";
break;
}
strcpy(msg, " ");
}
int xPos = _display.xCentre();
int yPos = _display.height() - 2*_display.textHeight();
_printMenuText(xPos, yPos, msg, false, eCentreJustify);
toPrint = getHeaterInfo().getErrStateStr();
}
else {
if(runstate) {
toPrint = getHeaterInfo().getRunStateStr();
// simplify starting states
switch(runstate) {
case 1:
case 2:
case 3:
case 4:
toPrint = "Starting";
break;
}
// }
}
}
if(toPrint) {
// locate at bottom centre

View file

@ -80,7 +80,7 @@ CExperimentalSettingsScreen::show()
}
else {
_printInverted(_display.xCentre(), 0, " Experimental ", true, eCentreJustify);
_printMenuText(65, Line3, "Overtemp:", false, eRightJustify);
_printMenuText(65, Line3, "Suspend:", false, eRightJustify);
_printMenuText(65, Line2, "Thermostat:", false, eRightJustify);
_printMenuText(65, Line1, "Window:", false, eRightJustify);
sprintf(msg, "%.1f\367C", _window); // \367 is octal for Adafruit degree symbol

View file

@ -1,3 +1,24 @@
/*
* This file is part of the "bluetoothheater" distribution
* (https://gitlab.com/mrjones.id.au/bluetoothheater)
*
* Copyright (C) 2018 Ray Jones <ray@mrjones.id.au>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#include <Arduino.h>
#include "Screen.h"

View file

@ -1,3 +1,24 @@
/*
* This file is part of the "bluetoothheater" distribution
* (https://gitlab.com/mrjones.id.au/bluetoothheater)
*
* Copyright (C) 2018 Ray Jones <ray@mrjones.id.au>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#include <Arduino.h>
#include "ScreenHeader.h"
#include "../Protocol/Protocol.h"

View file

@ -1,3 +1,24 @@
/*
* This file is part of the "bluetoothheater" distribution
* (https://gitlab.com/mrjones.id.au/bluetoothheater)
*
* Copyright (C) 2018 Ray Jones <ray@mrjones.id.au>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#include "ScreenManager.h"
#include "DetailedScreen.h"
#include "BasicScreen.h"

View file

@ -26,9 +26,9 @@ const uint8_t LED_Pin = 2;
const uint8_t UART_Rx = 3;
const uint8_t HC05_KeyPin = 4;
const uint8_t TxEnbPin = 5;
const uint8_t GPIO12_pin = 12; // HSPI std pins
const uint8_t GPIO13_pin = 13; // "
const uint8_t GPIO14_pin = 14; // "
const uint8_t Tx433MHz_pin = 12; // HSPI std pins
const uint8_t Rx433MHz_pin = 13; // "
const uint8_t GPIOout2_pin = 14; // "
const uint8_t DS18B20_Pin = 15;
const uint8_t Rx1Pin = 16;
const uint8_t Tx1Pin = 17;
@ -37,10 +37,12 @@ const uint8_t Rx2Pin = 19;
const uint8_t OLED_SDA_pin = 21; // I2C std pins
const uint8_t OLED_SCL_pin = 22; // "
const uint8_t HC05_SensePin = 23;
const uint8_t GPIO26_pin = 26;
const uint8_t GPIO27_pin = 27;
const uint8_t GPIOin2_pin = 25;
const uint8_t AlgInput_pin = 26;
const uint8_t GPIOout1_pin = 27;
const uint8_t keyUp_pin = 32;
const uint8_t GPIOin1_pin = 33;
const uint8_t keyDown_pin = 34; // input only, no chip pullup
const uint8_t keyCentre_pin = 35; // input only, no chip pullup
const uint8_t keyRight_pin = 36; // input only, no chip pullup