mirror of
https://github.com/UtilitechAS/amsreader-firmware.git
synced 2026-03-31 04:10:56 +00:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3312f88804 | ||
|
|
50faaca559 | ||
|
|
bf44849ecf | ||
|
|
4bfd9dee9a | ||
|
|
8f0932f1f1 | ||
|
|
aeb161455e | ||
|
|
568180d7b2 | ||
|
|
0d99da6c9a |
5
.github/workflows/build.yml
vendored
5
.github/workflows/build.yml
vendored
@@ -2,8 +2,11 @@ name: Build
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
paths:
|
||||||
|
- src/**
|
||||||
|
- lib/**
|
||||||
branches:
|
branches:
|
||||||
- '*'
|
- master
|
||||||
tags:
|
tags:
|
||||||
- '*'
|
- '*'
|
||||||
- '!v*.*.*'
|
- '!v*.*.*'
|
||||||
|
|||||||
9
.github/workflows/release.yml
vendored
9
.github/workflows/release.yml
vendored
@@ -69,3 +69,12 @@ jobs:
|
|||||||
asset_path: .pio/build/hw1esp12e/firmware.bin
|
asset_path: .pio/build/hw1esp12e/firmware.bin
|
||||||
asset_name: ams2mqtt-hw1esp12e-${{ steps.release_tag.outputs.tag }}.bin
|
asset_name: ams2mqtt-hw1esp12e-${{ steps.release_tag.outputs.tag }}.bin
|
||||||
asset_content_type: application/octet-stream
|
asset_content_type: application/octet-stream
|
||||||
|
- name: Upload featheresp32 binary to release
|
||||||
|
uses: actions/upload-release-asset@v1.0.1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||||
|
asset_path: .pio/build/featheresp32/firmware.bin
|
||||||
|
asset_name: ams2mqtt-featheresp32-${{ steps.release_tag.outputs.tag }}.bin
|
||||||
|
asset_content_type: application/octet-stream
|
||||||
|
|||||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -6,4 +6,5 @@
|
|||||||
*.sw[op]
|
*.sw[op]
|
||||||
.vscode
|
.vscode
|
||||||
.pio
|
.pio
|
||||||
platformio-user.ini
|
platformio-user.ini
|
||||||
|
src/version.h
|
||||||
142
lib/HanConfigAp/src/Base64.cpp
Normal file
142
lib/HanConfigAp/src/Base64.cpp
Normal file
@@ -0,0 +1,142 @@
|
|||||||
|
/*
|
||||||
|
Copyright (C) 2016 Arturo Guadalupi. All right reserved.
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library 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 Lesser General Public License for more details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "Base64.h"
|
||||||
|
#include <Arduino.h>
|
||||||
|
#if (defined(__AVR__))
|
||||||
|
#include <avr\pgmspace.h>
|
||||||
|
#else
|
||||||
|
#include <pgmspace.h>
|
||||||
|
#endif
|
||||||
|
const char PROGMEM _Base64AlphabetTable[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||||
|
"abcdefghijklmnopqrstuvwxyz"
|
||||||
|
"0123456789+/";
|
||||||
|
|
||||||
|
int Base64Class::encode(char *output, char *input, int inputLength) {
|
||||||
|
int i = 0, j = 0;
|
||||||
|
int encodedLength = 0;
|
||||||
|
unsigned char A3[3];
|
||||||
|
unsigned char A4[4];
|
||||||
|
|
||||||
|
while(inputLength--) {
|
||||||
|
A3[i++] = *(input++);
|
||||||
|
if(i == 3) {
|
||||||
|
fromA3ToA4(A4, A3);
|
||||||
|
|
||||||
|
for(i = 0; i < 4; i++) {
|
||||||
|
output[encodedLength++] = pgm_read_byte(&_Base64AlphabetTable[A4[i]]);
|
||||||
|
}
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(i) {
|
||||||
|
for(j = i; j < 3; j++) {
|
||||||
|
A3[j] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
fromA3ToA4(A4, A3);
|
||||||
|
|
||||||
|
for(j = 0; j < i + 1; j++) {
|
||||||
|
output[encodedLength++] = pgm_read_byte(&_Base64AlphabetTable[A4[j]]);
|
||||||
|
}
|
||||||
|
|
||||||
|
while((i++ < 3)) {
|
||||||
|
output[encodedLength++] = '=';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
output[encodedLength] = '\0';
|
||||||
|
return encodedLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Base64Class::decode(char * output, char * input, int inputLength) {
|
||||||
|
int i = 0, j = 0;
|
||||||
|
int decodedLength = 0;
|
||||||
|
unsigned char A3[3];
|
||||||
|
unsigned char A4[4];
|
||||||
|
|
||||||
|
|
||||||
|
while (inputLength--) {
|
||||||
|
if(*input == '=') {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
A4[i++] = *(input++);
|
||||||
|
if (i == 4) {
|
||||||
|
for (i = 0; i <4; i++) {
|
||||||
|
A4[i] = lookupTable(A4[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
fromA4ToA3(A3,A4);
|
||||||
|
|
||||||
|
for (i = 0; i < 3; i++) {
|
||||||
|
output[decodedLength++] = A3[i];
|
||||||
|
}
|
||||||
|
i = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i) {
|
||||||
|
for (j = i; j < 4; j++) {
|
||||||
|
A4[j] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
for (j = 0; j <4; j++) {
|
||||||
|
A4[j] = lookupTable(A4[j]);
|
||||||
|
}
|
||||||
|
|
||||||
|
fromA4ToA3(A3,A4);
|
||||||
|
|
||||||
|
for (j = 0; j < i - 1; j++) {
|
||||||
|
output[decodedLength++] = A3[j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
output[decodedLength] = '\0';
|
||||||
|
return decodedLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Base64Class::encodedLength(int plainLength) {
|
||||||
|
int n = plainLength;
|
||||||
|
return (n + 2 - ((n + 2) % 3)) / 3 * 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Base64Class::decodedLength(char * input, int inputLength) {
|
||||||
|
int i = 0;
|
||||||
|
int numEq = 0;
|
||||||
|
for(i = inputLength - 1; input[i] == '='; i--) {
|
||||||
|
numEq++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ((6 * inputLength) / 8) - numEq;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Private utility functions
|
||||||
|
inline void Base64Class::fromA3ToA4(unsigned char * A4, unsigned char * A3) {
|
||||||
|
A4[0] = (A3[0] & 0xfc) >> 2;
|
||||||
|
A4[1] = ((A3[0] & 0x03) << 4) + ((A3[1] & 0xf0) >> 4);
|
||||||
|
A4[2] = ((A3[1] & 0x0f) << 2) + ((A3[2] & 0xc0) >> 6);
|
||||||
|
A4[3] = (A3[2] & 0x3f);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void Base64Class::fromA4ToA3(unsigned char * A3, unsigned char * A4) {
|
||||||
|
A3[0] = (A4[0] << 2) + ((A4[1] & 0x30) >> 4);
|
||||||
|
A3[1] = ((A4[1] & 0xf) << 4) + ((A4[2] & 0x3c) >> 2);
|
||||||
|
A3[2] = ((A4[2] & 0x3) << 6) + A4[3];
|
||||||
|
}
|
||||||
|
|
||||||
|
inline unsigned char Base64Class::lookupTable(char c) {
|
||||||
|
if(c >='A' && c <='Z') return c - 'A';
|
||||||
|
if(c >='a' && c <='z') return c - 71;
|
||||||
|
if(c >='0' && c <='9') return c + 4;
|
||||||
|
if(c == '+') return 62;
|
||||||
|
if(c == '/') return 63;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
Base64Class Base64;
|
||||||
26
lib/HanConfigAp/src/Base64.h
Normal file
26
lib/HanConfigAp/src/Base64.h
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
Copyright (C) 2016 Arturo Guadalupi. All right reserved.
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library 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 Lesser General Public License for more details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _BASE64_H
|
||||||
|
#define _BASE64_H
|
||||||
|
|
||||||
|
class Base64Class{
|
||||||
|
public:
|
||||||
|
int encode(char *output, char *input, int inputLength);
|
||||||
|
int decode(char * output, char * input, int inputLength);
|
||||||
|
int encodedLength(int plainLength);
|
||||||
|
int decodedLength(char * input, int inputLength);
|
||||||
|
|
||||||
|
private:
|
||||||
|
inline void fromA3ToA4(unsigned char * A4, unsigned char * A3);
|
||||||
|
inline void fromA4ToA3(unsigned char * A3, unsigned char * A4);
|
||||||
|
inline unsigned char lookupTable(char c);
|
||||||
|
};
|
||||||
|
extern Base64Class Base64;
|
||||||
|
|
||||||
|
#endif // _BASE64_H
|
||||||
File diff suppressed because one or more lines are too long
@@ -27,6 +27,7 @@
|
|||||||
class HanConfigAp {
|
class HanConfigAp {
|
||||||
public:
|
public:
|
||||||
void setup(int accessPointButtonPin, Stream* debugger);
|
void setup(int accessPointButtonPin, Stream* debugger);
|
||||||
|
void enableWeb();
|
||||||
bool loop();
|
bool loop();
|
||||||
bool hasConfig();
|
bool hasConfig();
|
||||||
configuration config;
|
configuration config;
|
||||||
@@ -46,6 +47,7 @@ private:
|
|||||||
|
|
||||||
// Web server
|
// Web server
|
||||||
static void handleRoot();
|
static void handleRoot();
|
||||||
|
static void handleStyle();
|
||||||
static void handleSave();
|
static void handleSave();
|
||||||
#if defined(ESP8266)
|
#if defined(ESP8266)
|
||||||
static ESP8266WebServer server;
|
static ESP8266WebServer server;
|
||||||
|
|||||||
85
lib/HanConfigAp/src/config_html.h
Normal file
85
lib/HanConfigAp/src/config_html.h
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
const char CONFIG_HTML[] PROGMEM = R"=="==(
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
|
|
||||||
|
<link rel="stylesheet" type="text/css" href="/style.css">
|
||||||
|
|
||||||
|
<title>AMS2MQTT - configuration</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<form method='post' action='/save'>
|
||||||
|
<div class="wrapper">
|
||||||
|
<div class="inner-wrapper">
|
||||||
|
<div>
|
||||||
|
<h2>WiFi</h2>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<input type='text' name='ssid' value="${config.ssid}" placeholder="SSID">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<input type='password' name='ssidPassword' value="${config.ssidPassword}" placeholder="Password">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="inner-wrapper">
|
||||||
|
<div>
|
||||||
|
<h2>Meter Type</h2>
|
||||||
|
</div>
|
||||||
|
<div class="select-style">
|
||||||
|
<select name="meterType">
|
||||||
|
<option value="0" ${config.meterType0} disabled class="disabled-option"> SELECT TYPE </option>
|
||||||
|
<option value="1" ${config.meterType1}>Kaifa</option>
|
||||||
|
<option value="2" ${config.meterType2}>Aidon</option>
|
||||||
|
<option value="3" ${config.meterType3}>Kamstrup</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="inner-wrapper">
|
||||||
|
<div>
|
||||||
|
<h2>MQTT</h2>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label>Server & port:</label>
|
||||||
|
<input type='text' name='mqtt' value="${config.mqtt}" placeholder="server">
|
||||||
|
<input type='number' name='mqttPort' value="${config.mqttPort}" placeholder="port">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label>Client ID:</label>
|
||||||
|
<input type='text' name='mqttClientID' value="${config.mqttClientID}" placeholder="client id">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label>Publish topic: </label>
|
||||||
|
<input type='text' name='mqttPublishTopic' value="${config.mqttPublishTopic}" placeholder="topic">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label>Username:</label>
|
||||||
|
<input type='text' name='mqttUser' value="${config.mqttUser}" placeholder="Blank for insecure">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label>Password:</label>
|
||||||
|
<input type='password' name='mqttPass' value="${config.mqttPass}" placeholder="Blank for insecure">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<input class="submit-button" type='submit' value='save'>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="inner-wrapper">
|
||||||
|
<div>
|
||||||
|
<h2>Webserver</h2>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label>Username:</label>
|
||||||
|
<input type='text' name='authUser' value="${config.authUser}" placeholder="Blank for insecure">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label>Password:</label>
|
||||||
|
<input type='password' name='authPass' value="${config.authPass}" placeholder="Blank for insecure">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
<body>
|
||||||
|
</html>
|
||||||
|
)=="==";
|
||||||
@@ -38,6 +38,13 @@ bool configuration::save()
|
|||||||
else
|
else
|
||||||
address += saveBool(address, false);
|
address += saveBool(address, false);
|
||||||
|
|
||||||
|
|
||||||
|
address += saveBool(address, isAuth());
|
||||||
|
if (isAuth()) {
|
||||||
|
address += saveString(address, authUser);
|
||||||
|
address += saveString(address, authPass);
|
||||||
|
}
|
||||||
|
|
||||||
bool success = EEPROM.commit();
|
bool success = EEPROM.commit();
|
||||||
EEPROM.end();
|
EEPROM.end();
|
||||||
|
|
||||||
@@ -50,8 +57,22 @@ bool configuration::load()
|
|||||||
int address = EEPROM_CONFIG_ADDRESS;
|
int address = EEPROM_CONFIG_ADDRESS;
|
||||||
bool success = false;
|
bool success = false;
|
||||||
|
|
||||||
|
ssid = (char*)String("").c_str();
|
||||||
|
ssidPassword = (char*)String("").c_str();
|
||||||
|
meterType = (byte)0;
|
||||||
|
mqtt = (char*)String("").c_str();
|
||||||
|
mqttClientID = (char*)String("").c_str();
|
||||||
|
mqttPublishTopic = (char*)String("").c_str();
|
||||||
|
mqttSubscribeTopic = (char*)String("").c_str();
|
||||||
|
mqttUser = 0;
|
||||||
|
mqttPass = 0;
|
||||||
|
mqttPort = 1883;
|
||||||
|
authUser = 0;
|
||||||
|
authPass = 0;
|
||||||
|
|
||||||
EEPROM.begin(EEPROM_SIZE);
|
EEPROM.begin(EEPROM_SIZE);
|
||||||
if (EEPROM.read(address) == EEPROM_CHECK_SUM)
|
int cs = EEPROM.read(address);
|
||||||
|
if (cs >= 71)
|
||||||
{
|
{
|
||||||
address++;
|
address++;
|
||||||
|
|
||||||
@@ -80,18 +101,18 @@ bool configuration::load()
|
|||||||
|
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
else
|
if(cs >= 72) {
|
||||||
{
|
bool auth = false;
|
||||||
ssid = (char*)String("").c_str();
|
address += readBool(address, &auth);
|
||||||
ssidPassword = (char*)String("").c_str();
|
if (auth) {
|
||||||
meterType = (byte)0;
|
address += readString(address, &authUser);
|
||||||
mqtt = (char*)String("").c_str();
|
address += readString(address, &authPass);
|
||||||
mqttClientID = (char*)String("").c_str();
|
} else {
|
||||||
mqttPublishTopic = (char*)String("").c_str();
|
authUser = 0;
|
||||||
mqttSubscribeTopic = (char*)String("").c_str();
|
authPass = 0;
|
||||||
mqttUser = 0;
|
}
|
||||||
mqttPass = 0;
|
|
||||||
mqttPort = 1883;
|
success = true;
|
||||||
}
|
}
|
||||||
EEPROM.end();
|
EEPROM.end();
|
||||||
return success;
|
return success;
|
||||||
@@ -102,6 +123,10 @@ bool configuration::isSecure()
|
|||||||
return (mqttUser != 0) && (String(mqttUser).length() > 0);
|
return (mqttUser != 0) && (String(mqttUser).length() > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool configuration::isAuth() {
|
||||||
|
return (authUser != 0) && (String(authUser).length() > 0);
|
||||||
|
}
|
||||||
|
|
||||||
int configuration::readInt(int address, int *value)
|
int configuration::readInt(int address, int *value)
|
||||||
{
|
{
|
||||||
int lower = EEPROM.read(address);
|
int lower = EEPROM.read(address);
|
||||||
@@ -147,20 +172,6 @@ int configuration::saveByte(int address, byte value)
|
|||||||
}
|
}
|
||||||
void configuration::print(Stream* debugger)
|
void configuration::print(Stream* debugger)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
char* ssid;
|
|
||||||
char* ssidPassword;
|
|
||||||
byte meterType;
|
|
||||||
char* mqtt;
|
|
||||||
int mqttPort;
|
|
||||||
char* mqttClientID;
|
|
||||||
char* mqttPublishTopic;
|
|
||||||
char* mqttSubscribeTopic;
|
|
||||||
bool secure;
|
|
||||||
char* mqttUser;
|
|
||||||
char* mqttPass;
|
|
||||||
*/
|
|
||||||
|
|
||||||
debugger->println("Configuration:");
|
debugger->println("Configuration:");
|
||||||
debugger->println("-----------------------------------------------");
|
debugger->println("-----------------------------------------------");
|
||||||
debugger->printf("ssid: %s\r\n", this->ssid);
|
debugger->printf("ssid: %s\r\n", this->ssid);
|
||||||
@@ -178,6 +189,13 @@ void configuration::print(Stream* debugger)
|
|||||||
debugger->printf("mqttUser: %s\r\n", this->mqttUser);
|
debugger->printf("mqttUser: %s\r\n", this->mqttUser);
|
||||||
debugger->printf("mqttPass: %s\r\n", this->mqttPass);
|
debugger->printf("mqttPass: %s\r\n", this->mqttPass);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this->isAuth()) {
|
||||||
|
debugger->printf("WEB AUTH:\r\n");
|
||||||
|
debugger->printf("authUser: %s\r\n", this->authUser);
|
||||||
|
debugger->printf("authPass: %s\r\n", this->authPass);
|
||||||
|
}
|
||||||
|
|
||||||
debugger->println("-----------------------------------------------");
|
debugger->println("-----------------------------------------------");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,8 +25,12 @@ public:
|
|||||||
char* mqttPass;
|
char* mqttPass;
|
||||||
byte meterType;
|
byte meterType;
|
||||||
|
|
||||||
|
char* authUser;
|
||||||
|
char* authPass;
|
||||||
|
|
||||||
bool hasConfig();
|
bool hasConfig();
|
||||||
bool isSecure();
|
bool isSecure();
|
||||||
|
bool isAuth();
|
||||||
bool save();
|
bool save();
|
||||||
bool load();
|
bool load();
|
||||||
|
|
||||||
@@ -35,7 +39,7 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
const int EEPROM_SIZE = 512;
|
const int EEPROM_SIZE = 512;
|
||||||
const byte EEPROM_CHECK_SUM = 71; // Used to check if config is stored. Change if structure changes
|
const byte EEPROM_CHECK_SUM = 72; // Used to check if config is stored. Change if structure changes
|
||||||
const int EEPROM_CONFIG_ADDRESS = 0;
|
const int EEPROM_CONFIG_ADDRESS = 0;
|
||||||
|
|
||||||
int saveString(int pAddress, char* pString);
|
int saveString(int pAddress, char* pString);
|
||||||
|
|||||||
135
lib/HanConfigAp/src/style_css.h
Normal file
135
lib/HanConfigAp/src/style_css.h
Normal file
@@ -0,0 +1,135 @@
|
|||||||
|
const char STYLE_CSS[] PROGMEM = R"=="==(
|
||||||
|
body,div,input {
|
||||||
|
font-family: "Roboto", Arial, Lucida Grande;
|
||||||
|
}
|
||||||
|
.wrapper {
|
||||||
|
width: 500px;
|
||||||
|
position: absolute;
|
||||||
|
padding: 30px;
|
||||||
|
background-color: #FFF;
|
||||||
|
border-radius: 1px;
|
||||||
|
color: #333;
|
||||||
|
border-color: rgba(0, 0, 0, 0.03);
|
||||||
|
box-shadow: 0 2px 2px rgba(0, 0, 0, .24), 0 0 2px rgba(0, 0, 0, .12);
|
||||||
|
margin-left: 20px;
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
div {
|
||||||
|
padding-bottom: 5px;
|
||||||
|
}
|
||||||
|
label {
|
||||||
|
font-family: "Roboto", "Helvetica Neue", sans-serif;
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 16px;
|
||||||
|
width: 100px;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
input {
|
||||||
|
font-family: "Roboto", "Helvetica Neue", sans-serif;
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 16px;
|
||||||
|
bottom: 30px;
|
||||||
|
border: none;
|
||||||
|
border-bottom: 1px solid #d4d4d4;
|
||||||
|
padding: 10px;
|
||||||
|
background: transparent;
|
||||||
|
transition: all .25s ease;
|
||||||
|
}
|
||||||
|
input[type=number] {
|
||||||
|
width: 70px;
|
||||||
|
margin-left: 5px;
|
||||||
|
}
|
||||||
|
input:focus {
|
||||||
|
outline: none;
|
||||||
|
border-bottom: 1px solid #3f51b5;
|
||||||
|
}
|
||||||
|
h2 {
|
||||||
|
text-align: left;
|
||||||
|
font-size: 20px;
|
||||||
|
font-weight: bold;
|
||||||
|
letter-spacing: 3px;
|
||||||
|
line-height: 28px;
|
||||||
|
}
|
||||||
|
.submit-button {
|
||||||
|
position: absolute;
|
||||||
|
text-align: right;
|
||||||
|
border-radius: 20px;
|
||||||
|
border-bottom-right-radius: 0;
|
||||||
|
border-top-right-radius: 0;
|
||||||
|
background-color: #3f51b5;
|
||||||
|
color: #FFF;
|
||||||
|
padding: 12px 25px;
|
||||||
|
display: inline-block;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: bold;
|
||||||
|
letter-spacing: 2px;
|
||||||
|
right: 0px;
|
||||||
|
bottom: 10px;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all .25s ease;
|
||||||
|
box-shadow: 0 2px 2px rgba(0, 0, 0, .24), 0 0 2px rgba(0, 0, 0, .12);
|
||||||
|
width: 100px;
|
||||||
|
}
|
||||||
|
.select-style {
|
||||||
|
border-top: 10px solid white;
|
||||||
|
border-bottom: 1px solid #d4d4d4;
|
||||||
|
color: #ffffff;
|
||||||
|
cursor: pointer;
|
||||||
|
display: block;
|
||||||
|
font-family: Roboto, "Helvetica Neue", sans-serif;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 400;
|
||||||
|
height: 16px;
|
||||||
|
line-height: 14px;
|
||||||
|
min-width: 200px;
|
||||||
|
padding-bottom: 7px;
|
||||||
|
padding-left: 0px;
|
||||||
|
padding-right: 0px;
|
||||||
|
position: relative;
|
||||||
|
text-align: left;
|
||||||
|
width: 80%;
|
||||||
|
-webkit-box-direction: normal;
|
||||||
|
overflow: hidden;
|
||||||
|
background: #ffffff url("data:image/png;base64,R0lGODlhDwAUAIABAAAAAP///yH5BAEAAAEALAAAAAAPABQAAAIXjI+py+0Po5wH2HsXzmw//lHiSJZmUAAAOw==") no-repeat 98% 50%;
|
||||||
|
}
|
||||||
|
.disabled-option {
|
||||||
|
color: #d4d4d4;
|
||||||
|
}
|
||||||
|
.select-style select {
|
||||||
|
padding: 5px 8px;
|
||||||
|
width: 100%;
|
||||||
|
border: none;
|
||||||
|
box-shadow: none;
|
||||||
|
background: transparent;
|
||||||
|
background-image: none;
|
||||||
|
-webkit-appearance: none;
|
||||||
|
}
|
||||||
|
.select-style select:focus {
|
||||||
|
outline: none;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
@media only screen and (max-width: 1000px) {
|
||||||
|
.wrapper {
|
||||||
|
width: 80%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media only screen and (max-width: 300px) {
|
||||||
|
.wrapper {
|
||||||
|
width: 75%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media only screen and (max-width: 600px) {
|
||||||
|
.wrapper {
|
||||||
|
width: 80%;
|
||||||
|
margin-left: 0px;
|
||||||
|
margin-top: 0px;
|
||||||
|
}
|
||||||
|
.submit-button {
|
||||||
|
bottom: 0px;
|
||||||
|
width: 70px;
|
||||||
|
}
|
||||||
|
input {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)=="==";
|
||||||
@@ -59,10 +59,11 @@ HardwareSerial* debugger = NULL;
|
|||||||
HanReader hanReader;
|
HanReader hanReader;
|
||||||
|
|
||||||
// the setup function runs once when you press reset or power the board
|
// the setup function runs once when you press reset or power the board
|
||||||
void setup()
|
void setup() {
|
||||||
{
|
|
||||||
// Uncomment to debug over the same port as used for HAN communication
|
#if DEBUG_MODE
|
||||||
//debugger = &Serial;
|
debugger = &Serial;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (debugger) {
|
if (debugger) {
|
||||||
// Setup serial port for debugging
|
// Setup serial port for debugging
|
||||||
@@ -100,6 +101,8 @@ void setup()
|
|||||||
// Compensate for the known Kaifa bug
|
// Compensate for the known Kaifa bug
|
||||||
hanReader.compensateFor09HeaderBug = (ap.config.meterType == 1);
|
hanReader.compensateFor09HeaderBug = (ap.config.meterType == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ap.enableWeb();
|
||||||
}
|
}
|
||||||
|
|
||||||
// the loop function runs over and over again until power down or reset
|
// the loop function runs over and over again until power down or reset
|
||||||
|
|||||||
Reference in New Issue
Block a user