mirror of
https://git.mirrors.martin98.com/https://github.com/luc-github/ESP3D.git
synced 2025-08-12 06:18:59 +08:00
Add Script to parse all c/cpp/h/ino files and format them using clang-format with Google style
Update style to some files with clang-format using Google style Add Script to parse all embedded js/css files and format them using prettier based on .prettierrc config file Update style to embedded js/css files with prettier
This commit is contained in:
parent
9a597ca940
commit
ea1eb83a28
28
embedded/.prettierrc
Normal file
28
embedded/.prettierrc
Normal file
@ -0,0 +1,28 @@
|
||||
{
|
||||
"printWidth": 80,
|
||||
"tabWidth": 4,
|
||||
"useTabs": false,
|
||||
"semi": true,
|
||||
"singleQuote": true,
|
||||
"jsxSingleQuote": false,
|
||||
"trailingComma": "es5",
|
||||
"bracketSpacing": true,
|
||||
"bracketSameLine": false,
|
||||
"arrowParens": "always",
|
||||
"requirePragma": false,
|
||||
"insertPragma": false,
|
||||
"proseWrap": "preserve",
|
||||
"overrides": [
|
||||
{
|
||||
"files": "*.js",
|
||||
"options": {
|
||||
"parser": "babel"
|
||||
}
|
||||
},
|
||||
{"files": "*.scss",
|
||||
"options": {
|
||||
"parser": "css"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -1,95 +1,94 @@
|
||||
let path = require("path");
|
||||
const fs = require("fs");
|
||||
const { createReadStream, createWriteStream } = require("fs");
|
||||
const { createGzip } = require("zlib");
|
||||
const chalk = require("chalk");
|
||||
let path = require('path');
|
||||
const fs = require('fs');
|
||||
const { createReadStream, createWriteStream } = require('fs');
|
||||
const { createGzip } = require('zlib');
|
||||
const chalk = require('chalk');
|
||||
|
||||
let distPath = path.normalize(__dirname + "/../dist/");
|
||||
let srcPath = path.normalize(__dirname + "/../assets/");
|
||||
let distPath = path.normalize(__dirname + '/../dist/');
|
||||
let srcPath = path.normalize(__dirname + '/../assets/');
|
||||
let headerPath = path.normalize(
|
||||
__dirname + "/../../esp3d/src/modules/http/favicon.h"
|
||||
__dirname + '/../../esp3d/src/modules/http/favicon.h'
|
||||
);
|
||||
|
||||
|
||||
|
||||
const convertToC = (filepath) => {
|
||||
console.log(chalk.yellow("Converting bin to text file"));
|
||||
//Cleaning files
|
||||
if (fs.existsSync(distPath + "out.tmp")) fs.rmSync(distPath + "out.tmp");
|
||||
if (fs.existsSync(distPath + "favicon.h")) fs.rmSync(distPath + "favicon.h");
|
||||
console.log(chalk.yellow('Converting bin to text file'));
|
||||
//Cleaning files
|
||||
if (fs.existsSync(distPath + 'out.tmp')) fs.rmSync(distPath + 'out.tmp');
|
||||
if (fs.existsSync(distPath + 'favicon.h'))
|
||||
fs.rmSync(distPath + 'favicon.h');
|
||||
|
||||
const data = new Uint8Array(
|
||||
fs.readFileSync(filepath, { flag: "r" })
|
||||
);
|
||||
console.log("data size is ", data.length);
|
||||
let out = "#define favicon_size " + data.length + "\n";
|
||||
out += "const unsigned char favicon[" + data.length + "] PROGMEM = {\n ";
|
||||
let nb = 0;
|
||||
data.forEach((byte, index) => {
|
||||
out += " 0x" + (byte.toString(16).length == 1 ? "0" : "") + byte.toString(16);
|
||||
if (index < data.length - 1) out += ",";
|
||||
if (nb == 15) {
|
||||
out += "\n ";
|
||||
nb = 0;
|
||||
} else {
|
||||
nb++;
|
||||
}
|
||||
});
|
||||
const data = new Uint8Array(fs.readFileSync(filepath, { flag: 'r' }));
|
||||
console.log('data size is ', data.length);
|
||||
let out = '#define favicon_size ' + data.length + '\n';
|
||||
out += 'const unsigned char favicon[' + data.length + '] PROGMEM = {\n ';
|
||||
let nb = 0;
|
||||
data.forEach((byte, index) => {
|
||||
out +=
|
||||
' 0x' +
|
||||
(byte.toString(16).length == 1 ? '0' : '') +
|
||||
byte.toString(16);
|
||||
if (index < data.length - 1) out += ',';
|
||||
if (nb == 15) {
|
||||
out += '\n ';
|
||||
nb = 0;
|
||||
} else {
|
||||
nb++;
|
||||
}
|
||||
});
|
||||
|
||||
out += "\n};\n";
|
||||
fs.writeFileSync(distPath + "out.tmp", out);
|
||||
out += '\n};\n';
|
||||
fs.writeFileSync(distPath + 'out.tmp', out);
|
||||
|
||||
//Check conversion
|
||||
if (fs.existsSync(distPath + "out.tmp")) {
|
||||
console.log(chalk.green("[ok]"));
|
||||
} else {
|
||||
console.log(chalk.red("[error]Conversion failed"));
|
||||
return;
|
||||
}
|
||||
//Check conversion
|
||||
if (fs.existsSync(distPath + 'out.tmp')) {
|
||||
console.log(chalk.green('[ok]'));
|
||||
} else {
|
||||
console.log(chalk.red('[error]Conversion failed'));
|
||||
return;
|
||||
}
|
||||
|
||||
//Format header file
|
||||
console.log(chalk.yellow("Building header"));
|
||||
fs.writeFileSync(
|
||||
distPath + "favicon.h",
|
||||
fs.readFileSync(srcPath + "header.txt")
|
||||
);
|
||||
let bin2cfile = fs.readFileSync(distPath + "out.tmp").toString();
|
||||
fs.appendFileSync(distPath + "favicon.h", bin2cfile);
|
||||
fs.appendFileSync(
|
||||
distPath + "favicon.h",
|
||||
fs.readFileSync(srcPath + "footer.txt")
|
||||
);
|
||||
|
||||
//Check format result
|
||||
if (fs.existsSync(distPath + "favicon.h")) {
|
||||
console.log(chalk.green("[ok]"));
|
||||
} else {
|
||||
console.log(chalk.red("[error]Conversion failed"));
|
||||
return;
|
||||
}
|
||||
|
||||
//Move file to src
|
||||
console.log(chalk.yellow("Overwriting header in sources"));
|
||||
fs.writeFileSync(headerPath, fs.readFileSync(distPath + "favicon.h"));
|
||||
if (fs.existsSync(headerPath)) {
|
||||
console.log(chalk.green("[ok]"));
|
||||
} else {
|
||||
console.log(chalk.red("[error]Overwriting failed"));
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Create a gzip function for reusable purpose
|
||||
const compressFile = (filePath, targetPath) => {
|
||||
const stream = createReadStream(filePath);
|
||||
stream
|
||||
.pipe(createGzip(targetPath))
|
||||
.pipe(createWriteStream(targetPath))
|
||||
.on("finish", () =>{console.log(`Successfully compressed at ${targetPath}`);
|
||||
convertToC (targetPath)}
|
||||
//Format header file
|
||||
console.log(chalk.yellow('Building header'));
|
||||
fs.writeFileSync(
|
||||
distPath + 'favicon.h',
|
||||
fs.readFileSync(srcPath + 'header.txt')
|
||||
);
|
||||
let bin2cfile = fs.readFileSync(distPath + 'out.tmp').toString();
|
||||
fs.appendFileSync(distPath + 'favicon.h', bin2cfile);
|
||||
fs.appendFileSync(
|
||||
distPath + 'favicon.h',
|
||||
fs.readFileSync(srcPath + 'footer.txt')
|
||||
);
|
||||
|
||||
//Check format result
|
||||
if (fs.existsSync(distPath + 'favicon.h')) {
|
||||
console.log(chalk.green('[ok]'));
|
||||
} else {
|
||||
console.log(chalk.red('[error]Conversion failed'));
|
||||
return;
|
||||
}
|
||||
|
||||
//Move file to src
|
||||
console.log(chalk.yellow('Overwriting header in sources'));
|
||||
fs.writeFileSync(headerPath, fs.readFileSync(distPath + 'favicon.h'));
|
||||
if (fs.existsSync(headerPath)) {
|
||||
console.log(chalk.green('[ok]'));
|
||||
} else {
|
||||
console.log(chalk.red('[error]Overwriting failed'));
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
compressFile(srcPath + "favicon.ico", distPath + "favicon.ico.gz");
|
||||
// Create a gzip function for reusable purpose
|
||||
const compressFile = (filePath, targetPath) => {
|
||||
const stream = createReadStream(filePath);
|
||||
stream
|
||||
.pipe(createGzip(targetPath))
|
||||
.pipe(createWriteStream(targetPath))
|
||||
.on('finish', () => {
|
||||
console.log(`Successfully compressed at ${targetPath}`);
|
||||
convertToC(targetPath);
|
||||
});
|
||||
};
|
||||
|
||||
compressFile(srcPath + 'favicon.ico', distPath + 'favicon.ico.gz');
|
||||
|
@ -1,75 +1,76 @@
|
||||
let path = require("path");
|
||||
const fs = require("fs");
|
||||
const child_process = require("child_process");
|
||||
const chalk = require("chalk");
|
||||
let path = require('path');
|
||||
const fs = require('fs');
|
||||
const child_process = require('child_process');
|
||||
const chalk = require('chalk');
|
||||
|
||||
let distPath = path.normalize(__dirname + "/../dist/");
|
||||
let srcPath = path.normalize(__dirname + "/../src/");
|
||||
let distPath = path.normalize(__dirname + '/../dist/');
|
||||
let srcPath = path.normalize(__dirname + '/../src/');
|
||||
let headerPath = path.normalize(
|
||||
__dirname + "/../../esp3d/src/modules/http/embedded.h"
|
||||
__dirname + '/../../esp3d/src/modules/http/embedded.h'
|
||||
);
|
||||
|
||||
console.log(chalk.yellow("Converting bin to text file"));
|
||||
console.log(chalk.yellow('Converting bin to text file'));
|
||||
//Cleaning files
|
||||
if (fs.existsSync(distPath + "out.tmp")) fs.rmSync(distPath + "out.tmp");
|
||||
if (fs.existsSync(distPath + "embedded.h")) fs.rmSync(distPath + "embedded.h");
|
||||
if (fs.existsSync(distPath + 'out.tmp')) fs.rmSync(distPath + 'out.tmp');
|
||||
if (fs.existsSync(distPath + 'embedded.h')) fs.rmSync(distPath + 'embedded.h');
|
||||
|
||||
const data = new Uint8Array(
|
||||
fs.readFileSync(distPath + "index.html.gz", { flag: "r" })
|
||||
fs.readFileSync(distPath + 'index.html.gz', { flag: 'r' })
|
||||
);
|
||||
console.log("data size is ", data.length);
|
||||
let out = "#define tool_html_gz_size " + data.length + "\n";
|
||||
out += "const unsigned char tool_html_gz[" + data.length + "] PROGMEM = {\n ";
|
||||
console.log('data size is ', data.length);
|
||||
let out = '#define tool_html_gz_size ' + data.length + '\n';
|
||||
out += 'const unsigned char tool_html_gz[' + data.length + '] PROGMEM = {\n ';
|
||||
let nb = 0;
|
||||
data.forEach((byte, index) => {
|
||||
out += " 0x" + (byte.toString(16).length == 1 ? "0" : "") + byte.toString(16);
|
||||
if (index < data.length - 1) out += ",";
|
||||
if (nb == 15) {
|
||||
out += "\n ";
|
||||
nb = 0;
|
||||
} else {
|
||||
nb++;
|
||||
}
|
||||
out +=
|
||||
' 0x' + (byte.toString(16).length == 1 ? '0' : '') + byte.toString(16);
|
||||
if (index < data.length - 1) out += ',';
|
||||
if (nb == 15) {
|
||||
out += '\n ';
|
||||
nb = 0;
|
||||
} else {
|
||||
nb++;
|
||||
}
|
||||
});
|
||||
|
||||
out += "\n};\n";
|
||||
fs.writeFileSync(distPath + "out.tmp", out);
|
||||
out += '\n};\n';
|
||||
fs.writeFileSync(distPath + 'out.tmp', out);
|
||||
|
||||
//Check conversion
|
||||
if (fs.existsSync(distPath + "out.tmp")) {
|
||||
console.log(chalk.green("[ok]"));
|
||||
if (fs.existsSync(distPath + 'out.tmp')) {
|
||||
console.log(chalk.green('[ok]'));
|
||||
} else {
|
||||
console.log(chalk.red("[error]Conversion failed"));
|
||||
return;
|
||||
console.log(chalk.red('[error]Conversion failed'));
|
||||
return;
|
||||
}
|
||||
|
||||
//Format header file
|
||||
console.log(chalk.yellow("Building header"));
|
||||
console.log(chalk.yellow('Building header'));
|
||||
fs.writeFileSync(
|
||||
distPath + "embedded.h",
|
||||
fs.readFileSync(srcPath + "header.txt")
|
||||
distPath + 'embedded.h',
|
||||
fs.readFileSync(srcPath + 'header.txt')
|
||||
);
|
||||
let bin2cfile = fs.readFileSync(distPath + "out.tmp").toString();
|
||||
fs.appendFileSync(distPath + "embedded.h", bin2cfile);
|
||||
let bin2cfile = fs.readFileSync(distPath + 'out.tmp').toString();
|
||||
fs.appendFileSync(distPath + 'embedded.h', bin2cfile);
|
||||
fs.appendFileSync(
|
||||
distPath + "embedded.h",
|
||||
fs.readFileSync(srcPath + "footer.txt")
|
||||
distPath + 'embedded.h',
|
||||
fs.readFileSync(srcPath + 'footer.txt')
|
||||
);
|
||||
|
||||
//Check format result
|
||||
if (fs.existsSync(distPath + "embedded.h")) {
|
||||
console.log(chalk.green("[ok]"));
|
||||
if (fs.existsSync(distPath + 'embedded.h')) {
|
||||
console.log(chalk.green('[ok]'));
|
||||
} else {
|
||||
console.log(chalk.red("[error]Conversion failed"));
|
||||
return;
|
||||
console.log(chalk.red('[error]Conversion failed'));
|
||||
return;
|
||||
}
|
||||
|
||||
//Move file to src
|
||||
console.log(chalk.yellow("Overwriting header in sources"));
|
||||
fs.writeFileSync(headerPath, fs.readFileSync(distPath + "embedded.h"));
|
||||
console.log(chalk.yellow('Overwriting header in sources'));
|
||||
fs.writeFileSync(headerPath, fs.readFileSync(distPath + 'embedded.h'));
|
||||
if (fs.existsSync(headerPath)) {
|
||||
console.log(chalk.green("[ok]"));
|
||||
console.log(chalk.green('[ok]'));
|
||||
} else {
|
||||
console.log(chalk.red("[error]Overwriting failed"));
|
||||
return;
|
||||
console.log(chalk.red('[error]Overwriting failed'));
|
||||
return;
|
||||
}
|
||||
|
@ -1,15 +1,16 @@
|
||||
const path = require("path");
|
||||
const { createReadStream, createWriteStream } = require("fs");
|
||||
const { createGzip } = require("zlib");
|
||||
const faviconPath = path.normalize(__dirname + "/../assets/favicon.ico");
|
||||
|
||||
const path = require('path');
|
||||
const { createReadStream, createWriteStream } = require('fs');
|
||||
const { createGzip } = require('zlib');
|
||||
const faviconPath = path.normalize(__dirname + '/../assets/favicon.ico');
|
||||
|
||||
// Create a gzip function for reusable purpose
|
||||
const compressFile = (filePath) => {
|
||||
const stream = createReadStream(filePath);
|
||||
stream
|
||||
.pipe(createGzip())
|
||||
.pipe(createWriteStream(`${filePath}.gz`))
|
||||
.on("finish", () =>console.log(`Successfully compressed the file at ${filePath}`)
|
||||
);
|
||||
const stream = createReadStream(filePath);
|
||||
stream
|
||||
.pipe(createGzip())
|
||||
.pipe(createWriteStream(`${filePath}.gz`))
|
||||
.on('finish', () =>
|
||||
console.log(`Successfully compressed the file at ${filePath}`)
|
||||
);
|
||||
};
|
||||
compressFile(faviconPath);
|
||||
compressFile(faviconPath);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,53 +1,53 @@
|
||||
const path = require("path");
|
||||
const HtmlWebpackPlugin = require("html-webpack-plugin");
|
||||
const path = require('path');
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||
|
||||
module.exports = {
|
||||
mode: "development", // this will trigger some webpack default stuffs for dev
|
||||
entry: path.resolve(__dirname, "../src/index.js"), // if not set, default path to './src/index.js'. Accepts an object with multiple key-value pairs, with key as your custom bundle filename(substituting the [name]), and value as the corresponding file path
|
||||
output: {
|
||||
filename: "[name].bundle.js", // [name] will take whatever the input filename is. defaults to 'main' if only a single entry value
|
||||
path: path.resolve(__dirname, "../dist"), // the folder containing you final dist/build files. Default to './dist'
|
||||
},
|
||||
devServer: {
|
||||
historyApiFallback: true, // to make our SPA works after a full reload, so that it serves 'index.html' when 404 response
|
||||
open: true,
|
||||
static: {
|
||||
directory: path.resolve(__dirname, "./dist"),
|
||||
mode: 'development', // this will trigger some webpack default stuffs for dev
|
||||
entry: path.resolve(__dirname, '../src/index.js'), // if not set, default path to './src/index.js'. Accepts an object with multiple key-value pairs, with key as your custom bundle filename(substituting the [name]), and value as the corresponding file path
|
||||
output: {
|
||||
filename: '[name].bundle.js', // [name] will take whatever the input filename is. defaults to 'main' if only a single entry value
|
||||
path: path.resolve(__dirname, '../dist'), // the folder containing you final dist/build files. Default to './dist'
|
||||
},
|
||||
port: 8088,
|
||||
proxy: {
|
||||
context: () => true,
|
||||
target: "http://localhost:8080",
|
||||
},
|
||||
},
|
||||
stats: "minimal", // default behaviour spit out way too much info. adjust to your need.
|
||||
devtool: "source-map", // a sourcemap type. map to original source with line number
|
||||
plugins: [
|
||||
new HtmlWebpackPlugin({
|
||||
template: path.join(__dirname, "../src/index.html"),
|
||||
inlineSource: ".(js|css)$",
|
||||
inject: true,
|
||||
}),
|
||||
], // automatically creates a 'index.html' for us with our <link>, <style>, <script> tags inserted! Visit https://github.com/jantimon/html-webpack-plugin for more options
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.js$/,
|
||||
exclude: /(node_modules)/,
|
||||
use: {
|
||||
loader: "babel-loader",
|
||||
options: {
|
||||
presets: ["@babel/preset-env"],
|
||||
},
|
||||
devServer: {
|
||||
historyApiFallback: true, // to make our SPA works after a full reload, so that it serves 'index.html' when 404 response
|
||||
open: true,
|
||||
static: {
|
||||
directory: path.resolve(__dirname, './dist'),
|
||||
},
|
||||
},
|
||||
{
|
||||
test: /\.css$/, // run the loaders below only on .css files
|
||||
// this are the loaders. they interpret files, in this case css. they run from right to left sequence.
|
||||
// css-loader: "interprets @import and url() like import/require() and will resolve them."
|
||||
// style-loader: "Adds CSS to the DOM by injecting a <style> tag". this is fine for development.
|
||||
use: ["style-loader", "css-loader"],
|
||||
},
|
||||
],
|
||||
},
|
||||
port: 8088,
|
||||
proxy: {
|
||||
context: () => true,
|
||||
target: 'http://localhost:8080',
|
||||
},
|
||||
},
|
||||
stats: 'minimal', // default behaviour spit out way too much info. adjust to your need.
|
||||
devtool: 'source-map', // a sourcemap type. map to original source with line number
|
||||
plugins: [
|
||||
new HtmlWebpackPlugin({
|
||||
template: path.join(__dirname, '../src/index.html'),
|
||||
inlineSource: '.(js|css)$',
|
||||
inject: true,
|
||||
}),
|
||||
], // automatically creates a 'index.html' for us with our <link>, <style>, <script> tags inserted! Visit https://github.com/jantimon/html-webpack-plugin for more options
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.js$/,
|
||||
exclude: /(node_modules)/,
|
||||
use: {
|
||||
loader: 'babel-loader',
|
||||
options: {
|
||||
presets: ['@babel/preset-env'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
test: /\.css$/, // run the loaders below only on .css files
|
||||
// this are the loaders. they interpret files, in this case css. they run from right to left sequence.
|
||||
// css-loader: "interprets @import and url() like import/require() and will resolve them."
|
||||
// style-loader: "Adds CSS to the DOM by injecting a <style> tag". this is fine for development.
|
||||
use: ['style-loader', 'css-loader'],
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
@ -1,93 +1,93 @@
|
||||
const path = require("path");
|
||||
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
||||
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
|
||||
const HtmlWebpackPlugin = require("html-webpack-plugin");
|
||||
const HtmlMinimizerPlugin = require("html-minimizer-webpack-plugin");
|
||||
const HtmlInlineScriptPlugin = require("html-inline-script-webpack-plugin");
|
||||
const HTMLInlineCSSWebpackPlugin = require("html-inline-css-webpack-plugin")
|
||||
.default;
|
||||
const Compression = require("compression-webpack-plugin");
|
||||
const path = require('path');
|
||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
||||
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||
const HtmlMinimizerPlugin = require('html-minimizer-webpack-plugin');
|
||||
const HtmlInlineScriptPlugin = require('html-inline-script-webpack-plugin');
|
||||
const HTMLInlineCSSWebpackPlugin =
|
||||
require('html-inline-css-webpack-plugin').default;
|
||||
const Compression = require('compression-webpack-plugin');
|
||||
|
||||
module.exports = {
|
||||
mode: "production", // this trigger webpack out-of-box prod optimizations
|
||||
entry: path.resolve(__dirname, "../src/index.js"),
|
||||
output: {
|
||||
filename: `[name].[hash].js`, // [hash] is useful for cache busting!
|
||||
path: path.resolve(__dirname, "../dist"),
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.css$/,
|
||||
use: [MiniCssExtractPlugin.loader, "css-loader"],
|
||||
},
|
||||
{
|
||||
test: /\.js$/,
|
||||
exclude: /node_modules/,
|
||||
use: [
|
||||
{
|
||||
loader: "babel-loader",
|
||||
options: {
|
||||
presets: [
|
||||
[
|
||||
"@babel/preset-env",
|
||||
{
|
||||
useBuiltIns: "usage",
|
||||
debug: false,
|
||||
corejs: 3,
|
||||
targets: {"chrome": "88"},
|
||||
},
|
||||
],
|
||||
],
|
||||
mode: 'production', // this trigger webpack out-of-box prod optimizations
|
||||
entry: path.resolve(__dirname, '../src/index.js'),
|
||||
output: {
|
||||
filename: `[name].[hash].js`, // [hash] is useful for cache busting!
|
||||
path: path.resolve(__dirname, '../dist'),
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.css$/,
|
||||
use: [MiniCssExtractPlugin.loader, 'css-loader'],
|
||||
},
|
||||
{
|
||||
test: /\.js$/,
|
||||
exclude: /node_modules/,
|
||||
use: [
|
||||
{
|
||||
loader: 'babel-loader',
|
||||
options: {
|
||||
presets: [
|
||||
[
|
||||
'@babel/preset-env',
|
||||
{
|
||||
useBuiltIns: 'usage',
|
||||
debug: false,
|
||||
corejs: 3,
|
||||
targets: { chrome: '88' },
|
||||
},
|
||||
],
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
plugins: [
|
||||
// always deletes the dist folder first in each build run.
|
||||
new CleanWebpackPlugin(),
|
||||
new MiniCssExtractPlugin({
|
||||
filename: "[name].css",
|
||||
chunkFilename: "[id].css",
|
||||
}),
|
||||
new HtmlWebpackPlugin({
|
||||
template: path.join(__dirname, "../src/index.html"),
|
||||
inlineSource: ".(js|css)$",
|
||||
inject: "body",
|
||||
}),
|
||||
},
|
||||
plugins: [
|
||||
// always deletes the dist folder first in each build run.
|
||||
new CleanWebpackPlugin(),
|
||||
new MiniCssExtractPlugin({
|
||||
filename: '[name].css',
|
||||
chunkFilename: '[id].css',
|
||||
}),
|
||||
new HtmlWebpackPlugin({
|
||||
template: path.join(__dirname, '../src/index.html'),
|
||||
inlineSource: '.(js|css)$',
|
||||
inject: 'body',
|
||||
}),
|
||||
|
||||
new HtmlInlineScriptPlugin({
|
||||
new HtmlInlineScriptPlugin({
|
||||
scriptMatchPattern: [/.+[.]js$/],
|
||||
htmlMatchPattern: [/index.html$/],
|
||||
}),
|
||||
new HTMLInlineCSSWebpackPlugin(),
|
||||
new Compression({
|
||||
test: /\.(html)$/,
|
||||
filename: "[path][base].gz",
|
||||
algorithm: "gzip",
|
||||
exclude: /.map$/,
|
||||
deleteOriginalAssets: "keep-source-map",
|
||||
}),
|
||||
],
|
||||
optimization: {
|
||||
minimize: true,
|
||||
minimizer: [
|
||||
new HtmlMinimizerPlugin({
|
||||
minimizerOptions: {
|
||||
collapseWhitespace: true,
|
||||
minifyCSS: true,
|
||||
minifyJS: true,
|
||||
},
|
||||
minify: (data, minimizerOptions) => {
|
||||
const htmlMinifier = require("html-minifier-terser");
|
||||
const [[filename, input]] = Object.entries(data);
|
||||
|
||||
return htmlMinifier.minify(input, minimizerOptions);
|
||||
},
|
||||
}),
|
||||
new HTMLInlineCSSWebpackPlugin(),
|
||||
new Compression({
|
||||
test: /\.(html)$/,
|
||||
filename: '[path][base].gz',
|
||||
algorithm: 'gzip',
|
||||
exclude: /.map$/,
|
||||
deleteOriginalAssets: 'keep-source-map',
|
||||
}),
|
||||
],
|
||||
},
|
||||
devtool: "source-map", // supposedly the ideal type without bloating bundle size
|
||||
optimization: {
|
||||
minimize: true,
|
||||
minimizer: [
|
||||
new HtmlMinimizerPlugin({
|
||||
minimizerOptions: {
|
||||
collapseWhitespace: true,
|
||||
minifyCSS: true,
|
||||
minifyJS: true,
|
||||
},
|
||||
minify: (data, minimizerOptions) => {
|
||||
const htmlMinifier = require('html-minifier-terser');
|
||||
const [[filename, input]] = Object.entries(data);
|
||||
|
||||
return htmlMinifier.minify(input, minimizerOptions);
|
||||
},
|
||||
}),
|
||||
],
|
||||
},
|
||||
devtool: 'source-map', // supposedly the ideal type without bloating bundle size
|
||||
};
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,15 +1,18 @@
|
||||
function initMenus() {
|
||||
document.getElementById("FWLink").addEventListener("click", function () {
|
||||
window.open("https://github.com/luc-github/ESP3D/tree/3.0", "_blank");
|
||||
});
|
||||
document.getElementById('FWLink').addEventListener('click', function () {
|
||||
window.open('https://github.com/luc-github/ESP3D/tree/3.0', '_blank');
|
||||
});
|
||||
|
||||
document.getElementById("UiLink").addEventListener("click", function () {
|
||||
window.open("https://github.com/luc-github/ESP3D-WEBUI/tree/3.0", "_blank");
|
||||
});
|
||||
document.getElementById('UiLink').addEventListener('click', function () {
|
||||
window.open(
|
||||
'https://github.com/luc-github/ESP3D-WEBUI/tree/3.0',
|
||||
'_blank'
|
||||
);
|
||||
});
|
||||
|
||||
document.getElementById("hlpLink").addEventListener("click", function () {
|
||||
window.open("https://github.com/luc-github/ESP3D/wiki", "_blank");
|
||||
});
|
||||
document.getElementById('hlpLink').addEventListener('click', function () {
|
||||
window.open('https://github.com/luc-github/ESP3D/wiki', '_blank');
|
||||
});
|
||||
}
|
||||
|
||||
export { initMenus };
|
||||
|
@ -1,368 +1,368 @@
|
||||
* {
|
||||
font-family: sans-serif;
|
||||
color: #5755d9;
|
||||
background-color: #eef0f3;
|
||||
-webkit-user-select: none; /* Chrome all / Safari all */
|
||||
-moz-user-select: none; /* Firefox all */
|
||||
-ms-user-select: none; /* IE 10+ */
|
||||
user-select: none;
|
||||
font-family: sans-serif;
|
||||
color: #5755d9;
|
||||
background-color: #eef0f3;
|
||||
-webkit-user-select: none; /* Chrome all / Safari all */
|
||||
-moz-user-select: none; /* Firefox all */
|
||||
-ms-user-select: none; /* IE 10+ */
|
||||
user-select: none;
|
||||
}
|
||||
body {
|
||||
min-width: 360px;
|
||||
min-width: 360px;
|
||||
}
|
||||
hr {
|
||||
border-top: 1px solid #5755d9;
|
||||
border-top: 1px solid #5755d9;
|
||||
}
|
||||
|
||||
.controlBar {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
padding: 10px;
|
||||
padding-left: 15px;
|
||||
background-color: white;
|
||||
margin-bottom: 6px;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
padding: 10px;
|
||||
padding-left: 15px;
|
||||
background-color: white;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
.cmd {
|
||||
color: #555555;
|
||||
color: #555555;
|
||||
}
|
||||
label {
|
||||
display: block;
|
||||
width: auto;
|
||||
padding: 3px 12px;
|
||||
color: #5755d9;
|
||||
background-color: #ffffff;
|
||||
cursor: pointer;
|
||||
display: block;
|
||||
width: auto;
|
||||
padding: 3px 12px;
|
||||
color: #5755d9;
|
||||
background-color: #ffffff;
|
||||
cursor: pointer;
|
||||
}
|
||||
pre {
|
||||
padding-left: 5px;
|
||||
padding-right: 5px;
|
||||
padding-left: 5px;
|
||||
padding-right: 5px;
|
||||
}
|
||||
|
||||
.modal {
|
||||
position: fixed; /* Stay in place */
|
||||
z-index: 10000; /* Sit on top */
|
||||
padding-top: 100px; /* Location of the box */
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%; /* Full width */
|
||||
height: 100%; /* Full height */
|
||||
overflow: auto; /* Enable scroll if needed */
|
||||
background-color: rgb(0, 0, 0); /* Fallback color */
|
||||
background-color: rgba(0, 0, 0, 0.4); /* Black w/ opacity */
|
||||
position: fixed; /* Stay in place */
|
||||
z-index: 10000; /* Sit on top */
|
||||
padding-top: 100px; /* Location of the box */
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%; /* Full width */
|
||||
height: 100%; /* Full height */
|
||||
overflow: auto; /* Enable scroll if needed */
|
||||
background-color: rgb(0, 0, 0); /* Fallback color */
|
||||
background-color: rgba(0, 0, 0, 0.4); /* Black w/ opacity */
|
||||
}
|
||||
|
||||
/* Modal Content */
|
||||
.modal-content {
|
||||
border-top-left-radius: 10px;
|
||||
border-top-right-radius: 10px;
|
||||
border-bottom-left-radius: 10px;
|
||||
border-bottom-right-radius: 10px;
|
||||
background-color: #5755d9;
|
||||
border: 1px solid #5755d9;
|
||||
position: relative;
|
||||
margin: auto;
|
||||
padding: 0;
|
||||
max-width: 450px;
|
||||
border-top-left-radius: 10px;
|
||||
border-top-right-radius: 10px;
|
||||
border-bottom-left-radius: 10px;
|
||||
border-bottom-right-radius: 10px;
|
||||
background-color: #5755d9;
|
||||
border: 1px solid #5755d9;
|
||||
position: relative;
|
||||
margin: auto;
|
||||
padding: 0;
|
||||
max-width: 450px;
|
||||
}
|
||||
|
||||
.modal-header {
|
||||
padding: 16px 16px;
|
||||
color: #ffffff;
|
||||
background-color: #5755d9;
|
||||
border-top-left-radius: 10px;
|
||||
border-top-right-radius: 10px;
|
||||
border-bottom: 1px solid #5755d9;
|
||||
height: 2.5rem;
|
||||
line-height: 2.5rem;
|
||||
font-size: 1.5rem;
|
||||
padding: 16px 16px;
|
||||
color: #ffffff;
|
||||
background-color: #5755d9;
|
||||
border-top-left-radius: 10px;
|
||||
border-top-right-radius: 10px;
|
||||
border-bottom: 1px solid #5755d9;
|
||||
height: 2.5rem;
|
||||
line-height: 2.5rem;
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
|
||||
.modal-body {
|
||||
padding: 10px 16px;
|
||||
background-color: #ffffff;
|
||||
padding: 10px 16px;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
.modal-footer {
|
||||
padding: 16px 16px;
|
||||
height: 2.5em;
|
||||
background-color: #ffffff;
|
||||
border-top: 1px solid #5755d9;
|
||||
border-bottom-left-radius: 10px;
|
||||
border-bottom-right-radius: 10px;
|
||||
display: flex;
|
||||
flex-direction: row-reverse;
|
||||
padding: 16px 16px;
|
||||
height: 2.5em;
|
||||
background-color: #ffffff;
|
||||
border-top: 1px solid #5755d9;
|
||||
border-bottom-left-radius: 10px;
|
||||
border-bottom-right-radius: 10px;
|
||||
display: flex;
|
||||
flex-direction: row-reverse;
|
||||
}
|
||||
|
||||
input {
|
||||
display: block;
|
||||
width: auto;
|
||||
height: 1.5rem;
|
||||
padding: 6px 12px;
|
||||
line-height: 1.42857143;
|
||||
border-radius: 4px;
|
||||
color: #5755d9;
|
||||
background-color: #ffffff;
|
||||
outline: 0;
|
||||
display: block;
|
||||
width: auto;
|
||||
height: 1.5rem;
|
||||
padding: 6px 12px;
|
||||
line-height: 1.42857143;
|
||||
border-radius: 4px;
|
||||
color: #5755d9;
|
||||
background-color: #ffffff;
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
input {
|
||||
border: 1px solid #5755d9;
|
||||
border: 1px solid #5755d9;
|
||||
}
|
||||
|
||||
button {
|
||||
display: block;
|
||||
width: auto;
|
||||
height: 2.4rem;
|
||||
padding: 6px 12px;
|
||||
line-height: 1.42857143;
|
||||
vertical-align: middle;
|
||||
cursor: pointer;
|
||||
border: 1px solid black;
|
||||
white-space: nowrap;
|
||||
border-radius: 4px;
|
||||
color: #ffffff;
|
||||
background-color: #5755d9;
|
||||
display: block;
|
||||
width: auto;
|
||||
height: 2.4rem;
|
||||
padding: 6px 12px;
|
||||
line-height: 1.42857143;
|
||||
vertical-align: middle;
|
||||
cursor: pointer;
|
||||
border: 1px solid black;
|
||||
white-space: nowrap;
|
||||
border-radius: 4px;
|
||||
color: #ffffff;
|
||||
background-color: #5755d9;
|
||||
}
|
||||
|
||||
::-moz-progress-bar {
|
||||
background-color: #5755d9;
|
||||
background-color: #5755d9;
|
||||
}
|
||||
|
||||
::-webkit-progress-value {
|
||||
background-color: #5755d9;
|
||||
background-color: #5755d9;
|
||||
}
|
||||
|
||||
::-webkit-progress-bar {
|
||||
background-color: #f1f1f1;
|
||||
background-color: #f1f1f1;
|
||||
}
|
||||
|
||||
progress,
|
||||
.progbar {
|
||||
margin-top: 10px;
|
||||
height: 1rem;
|
||||
background-color: #f1f1f1;
|
||||
border: 1px solid #5755d9;
|
||||
margin-top: 10px;
|
||||
height: 1rem;
|
||||
background-color: #f1f1f1;
|
||||
border: 1px solid #5755d9;
|
||||
}
|
||||
|
||||
.label {
|
||||
height: 2.4rem;
|
||||
padding: 6px 12px;
|
||||
line-height: 1.42857143;
|
||||
vertical-align: middle;
|
||||
display: inline-block;
|
||||
width: auto;
|
||||
color: #5755d9;
|
||||
background-color: #ffffff;
|
||||
overflow-wrap: anywhere;
|
||||
height: 2.4rem;
|
||||
padding: 6px 12px;
|
||||
line-height: 1.42857143;
|
||||
vertical-align: middle;
|
||||
display: inline-block;
|
||||
width: auto;
|
||||
color: #5755d9;
|
||||
background-color: #ffffff;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.controlBar > button {
|
||||
margin-right: 15px;
|
||||
margin-right: 15px;
|
||||
}
|
||||
|
||||
meter {
|
||||
background-color: #ffffff;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
button:active {
|
||||
background-color: #0b0899;
|
||||
background-color: #0b0899;
|
||||
}
|
||||
|
||||
ul {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
list-style-type: none;
|
||||
margin: 3px;
|
||||
padding: 3px;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
list-style-type: none;
|
||||
margin: 3px;
|
||||
padding: 3px;
|
||||
}
|
||||
|
||||
pre {
|
||||
margin: 10px 10px;
|
||||
min-height: 350px;
|
||||
max-height: 350px;
|
||||
border: 1px solid #5755d9;
|
||||
overflow-y: auto;
|
||||
overflow-wrap: anywhere;
|
||||
margin: 10px 10px;
|
||||
min-height: 350px;
|
||||
max-height: 350px;
|
||||
border: 1px solid #5755d9;
|
||||
overflow-y: auto;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
li {
|
||||
padding: 9px 14px;
|
||||
margin: 0px 1rem;
|
||||
border: 1px hidden;
|
||||
padding: 9px 14px;
|
||||
margin: 0px 1rem;
|
||||
border: 1px hidden;
|
||||
}
|
||||
|
||||
.menuspacer {
|
||||
flex-grow: 1;
|
||||
pointer-events: none;
|
||||
flex-grow: 1;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.panel {
|
||||
margin: 10px 10px;
|
||||
border-radius: 10px;
|
||||
margin: 10px 10px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.text-primary {
|
||||
color: #5755d9;
|
||||
color: #5755d9;
|
||||
}
|
||||
.text-error {
|
||||
color: red;
|
||||
color: red;
|
||||
}
|
||||
|
||||
.text-error-login {
|
||||
background-color: white;
|
||||
color: red;
|
||||
text-align: center;
|
||||
background-color: white;
|
||||
color: red;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.disabled {
|
||||
pointer-events: none;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.panel-header {
|
||||
border-top-left-radius: 10px;
|
||||
border-top-right-radius: 10px;
|
||||
background-color: #5755d9;
|
||||
color: white;
|
||||
height: 2rem;
|
||||
line-height: 2rem;
|
||||
padding: 2px 15px;
|
||||
cursor: pointer;
|
||||
border-top-left-radius: 10px;
|
||||
border-top-right-radius: 10px;
|
||||
background-color: #5755d9;
|
||||
color: white;
|
||||
height: 2rem;
|
||||
line-height: 2rem;
|
||||
padding: 2px 15px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.no-header {
|
||||
border-top-left-radius: 10px;
|
||||
border-top-right-radius: 10px;
|
||||
border-top: 1px solid #5755d9;
|
||||
border-top-left-radius: 10px;
|
||||
border-top-right-radius: 10px;
|
||||
border-top: 1px solid #5755d9;
|
||||
}
|
||||
|
||||
.no-footer {
|
||||
border-bottom-left-radius: 10px;
|
||||
border-bottom-right-radius: 10px;
|
||||
border-bottom: 1px solid #5755d9;
|
||||
border-bottom-left-radius: 10px;
|
||||
border-bottom-right-radius: 10px;
|
||||
border-bottom: 1px solid #5755d9;
|
||||
}
|
||||
|
||||
.panel-footer {
|
||||
border-bottom-left-radius: 10px;
|
||||
border-bottom-right-radius: 10px;
|
||||
border: 1px solid #5755d9;
|
||||
background-color: white;
|
||||
min-height: 2rem;
|
||||
line-height: 2rem;
|
||||
padding: 2px 15px;
|
||||
margin: 0px 0px;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
-ms-flex-wrap: wrap;
|
||||
flex-wrap: wrap;
|
||||
border-bottom-left-radius: 10px;
|
||||
border-bottom-right-radius: 10px;
|
||||
border: 1px solid #5755d9;
|
||||
background-color: white;
|
||||
min-height: 2rem;
|
||||
line-height: 2rem;
|
||||
padding: 2px 15px;
|
||||
margin: 0px 0px;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
-ms-flex-wrap: wrap;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.panel-footer span {
|
||||
background-color: white;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
.panel-body {
|
||||
min-height: 50px;
|
||||
background-color: white;
|
||||
border-right: 1px solid #5755d9;
|
||||
border-left: 1px solid #5755d9;
|
||||
min-height: 50px;
|
||||
background-color: white;
|
||||
border-right: 1px solid #5755d9;
|
||||
border-left: 1px solid #5755d9;
|
||||
}
|
||||
|
||||
.no-header {
|
||||
padding: 10px 10px;
|
||||
padding: 10px 10px;
|
||||
}
|
||||
|
||||
.hide {
|
||||
display: none;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.filesize,
|
||||
.filetype,
|
||||
.fileitem,
|
||||
.fileicon {
|
||||
padding: 5px 5px;
|
||||
border-radius: 5px 5px;
|
||||
background-color: white;
|
||||
padding: 5px 5px;
|
||||
border-radius: 5px 5px;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
.fileLineTail {
|
||||
background-color: white;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
column-gap: 10px;
|
||||
background-color: white;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
column-gap: 10px;
|
||||
}
|
||||
|
||||
.fileLineHead {
|
||||
background-color: white;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
column-gap: 10px;
|
||||
background-color: white;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
column-gap: 10px;
|
||||
}
|
||||
|
||||
.fileLine {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
line-height: 1.42857143;
|
||||
vertical-align: center;
|
||||
border-top: 1px solid #5755d9;
|
||||
background-color: white;
|
||||
padding: 8px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
line-height: 1.42857143;
|
||||
vertical-align: center;
|
||||
border-top: 1px solid #5755d9;
|
||||
background-color: white;
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
svg {
|
||||
background-color: white;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
.fileicon:hover {
|
||||
cursor: pointer;
|
||||
background-color: #5755d9;
|
||||
color: #5755d9;
|
||||
cursor: pointer;
|
||||
background-color: #5755d9;
|
||||
color: #5755d9;
|
||||
}
|
||||
|
||||
.fileitem:hover,
|
||||
li:active,
|
||||
li:hover {
|
||||
cursor: pointer;
|
||||
background-color: #5755d9;
|
||||
color: white;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
background-color: #5755d9;
|
||||
color: white;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.fileitem:active {
|
||||
background-color: #0b0899;
|
||||
background-color: #0b0899;
|
||||
}
|
||||
|
||||
.fileicon:hover > svg {
|
||||
cursor: pointer;
|
||||
background-color: #5755d9;
|
||||
color: #5755d9;
|
||||
cursor: pointer;
|
||||
background-color: #5755d9;
|
||||
color: #5755d9;
|
||||
}
|
||||
.m-1{
|
||||
margin-left: 1rem;
|
||||
margin-right: 1rem;
|
||||
.m-1 {
|
||||
margin-left: 1rem;
|
||||
margin-right: 1rem;
|
||||
}
|
||||
button > svg {
|
||||
background-color: #5755d9;
|
||||
text-decoration-color: #ffffff;
|
||||
color: white !important;
|
||||
background-color: #5755d9;
|
||||
text-decoration-color: #ffffff;
|
||||
color: white !important;
|
||||
}
|
||||
|
||||
button:active > svg,
|
||||
.fileicon:active > svg,
|
||||
.fileicon:active {
|
||||
background-color: #0b0899;
|
||||
background-color: #0b0899;
|
||||
}
|
||||
|
||||
#MSG {
|
||||
text-align: center;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#monitor_enable_autoscroll {
|
||||
margin: 0px 0px;
|
||||
cursor: pointer;
|
||||
margin: 0px 0px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 600px) {
|
||||
.menuspacer {
|
||||
display: none;
|
||||
}
|
||||
.menuspacer {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
63
embedded/tools/format_sources.py
Normal file
63
embedded/tools/format_sources.py
Normal file
@ -0,0 +1,63 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
from shutil import which
|
||||
|
||||
def format_sources():
|
||||
"""
|
||||
Format JavaScript and CSS files using Prettier.
|
||||
|
||||
This script locates all JavaScript and CSS files in the 'src' and 'config' directories
|
||||
(including subdirectories) and formats them using the Prettier tool. It requires Node.js
|
||||
and the Prettier package to be installed.
|
||||
|
||||
Returns:
|
||||
None
|
||||
"""
|
||||
# Base directory of the script
|
||||
script_path = os.path.abspath(__file__)
|
||||
|
||||
# Extract dir path
|
||||
script_dir = os.path.dirname(script_path)
|
||||
|
||||
# Build paths of sources dirs: ../src and ../config
|
||||
src_dir = os.path.abspath(os.path.normpath(os.path.join(script_dir, '..', 'src')))
|
||||
config_dir = os.path.abspath(os.path.normpath(os.path.join(script_dir, '..', 'config')))
|
||||
|
||||
# Parse all c, h , cpp, js, css files in all directories and sub directories
|
||||
file_paths = []
|
||||
for base_dir in [src_dir, config_dir]:
|
||||
for root, dirs, files in os.walk(base_dir):
|
||||
for file in files:
|
||||
if file.endswith(('.js', '.css')):
|
||||
file_path = os.path.join(root, file)
|
||||
file_paths.append(os.path.abspath(os.path.normpath(file_path)))
|
||||
print(os.path.abspath(os.path.normpath(file_path)))
|
||||
|
||||
# Locate the Prettier binary
|
||||
node_path = which('node')
|
||||
print(node_path)
|
||||
if not node_path:
|
||||
print("node not found in PATH. Please install it globally or locally.")
|
||||
exit(1)
|
||||
node_dir = os.path.dirname(node_path)
|
||||
client_path = os.path.join('node_modules', 'npm', 'bin', 'npx-cli.js')
|
||||
print(client_path)
|
||||
|
||||
# Now format all files one by one with prettier
|
||||
prettierrc_path = os.path.abspath(os.path.normpath(os.path.join(script_dir, '..', '.prettierrc')))
|
||||
print("Using:" + prettierrc_path)
|
||||
for file_path in file_paths:
|
||||
tmpPath = file_path
|
||||
print("Formating " + tmpPath)
|
||||
try:
|
||||
command = ['node', client_path, 'prettier', '--write', tmpPath]
|
||||
print(command)
|
||||
subprocess.run(command, check=False, cwd=node_dir)
|
||||
print("=> Ok")
|
||||
except subprocess.CalledProcessError as e:
|
||||
print(f'=>Error : {e}')
|
||||
|
||||
# Call the format_sources function
|
||||
format_sources()
|
@ -37,17 +37,17 @@
|
||||
#endif
|
||||
/************************************
|
||||
*
|
||||
* ESP32 C3 -patch
|
||||
*
|
||||
* ESP32 C3 -patch
|
||||
*
|
||||
* Uncomment only if your ESP32 C3 board cannot start
|
||||
*
|
||||
************************************/
|
||||
//Possible values
|
||||
//WIFI_POWER_5dBm
|
||||
//WIFI_POWER_8_5dBm
|
||||
//WIFI_POWER_15dBm
|
||||
// Possible values
|
||||
// WIFI_POWER_5dBm
|
||||
// WIFI_POWER_8_5dBm
|
||||
// WIFI_POWER_15dBm
|
||||
|
||||
//#define ESP32_WIFI_TX_POWER WIFI_POWER_15dBm
|
||||
// #define ESP32_WIFI_TX_POWER WIFI_POWER_15dBm
|
||||
|
||||
/************************************
|
||||
*
|
||||
@ -540,7 +540,7 @@
|
||||
/* Enable authentication
|
||||
* Force usage of authentication for commands
|
||||
*/
|
||||
//#define AUTHENTICATION_FEATURE
|
||||
// #define AUTHENTICATION_FEATURE
|
||||
|
||||
/************************************
|
||||
*
|
||||
@ -576,13 +576,13 @@
|
||||
|
||||
/* Hook when got IP
|
||||
* Commands to run on event
|
||||
* Separate commands with ';'
|
||||
* Separate commands with ';'
|
||||
*/
|
||||
#define ESP_GOT_IP_HOOK "[ESP212]IP:%ESP_IP%"
|
||||
|
||||
/* Hook when got date time
|
||||
* Commands to run on event
|
||||
* Separate commands with ';'
|
||||
* Separate commands with ';'
|
||||
*/
|
||||
#define ESP_GOT_DATE_TIME_HOOK "[ESP212]DATE:%ESP_DATETIME%"
|
||||
|
||||
@ -617,10 +617,9 @@
|
||||
// LOG_OUTPUT_SERIAL2
|
||||
// LOG_OUTPUT_TELNET
|
||||
// LOG_OUTPUT_WEBSOCKET
|
||||
//#define ESP_LOG_FEATURE LOG_OUTPUT_SERIAL0
|
||||
|
||||
//#define ESP3D_DEBUG_LEVEL LOG_LEVEL_DEBUG
|
||||
// #define ESP_LOG_FEATURE LOG_OUTPUT_SERIAL0
|
||||
|
||||
// #define ESP3D_DEBUG_LEVEL LOG_LEVEL_DEBUG
|
||||
|
||||
#ifdef ESP_LOG_FEATURE
|
||||
#define LOG_ESP3D_BAUDRATE 115200
|
||||
@ -639,7 +638,8 @@
|
||||
* Do not modify
|
||||
************************************/
|
||||
|
||||
#if defined(ESP_GOT_DATE_TIME_HOOK) ||defined(SD_TIMESTAMP_FEATURE) || defined(FILESYSTEM_TIMESTAMP_FEATURE)
|
||||
#if defined(ESP_GOT_DATE_TIME_HOOK) || defined(SD_TIMESTAMP_FEATURE) || \
|
||||
defined(FILESYSTEM_TIMESTAMP_FEATURE)
|
||||
#define TIMESTAMP_FEATURE
|
||||
#endif // SD_TIMESTAMP_FEATURE || FILESYSTEM_TIMESTAMP_FEATURE
|
||||
|
||||
|
@ -19,17 +19,11 @@
|
||||
*/
|
||||
|
||||
#include "src/core/esp3d.h"
|
||||
//global variable
|
||||
// global variable
|
||||
Esp3D myesp3d;
|
||||
|
||||
//Setup
|
||||
void setup()
|
||||
{
|
||||
myesp3d.begin();
|
||||
}
|
||||
// Setup
|
||||
void setup() { myesp3d.begin(); }
|
||||
|
||||
//main loop
|
||||
void loop()
|
||||
{
|
||||
myesp3d.handle();
|
||||
}
|
||||
// main loop
|
||||
void loop() { myesp3d.handle(); }
|
||||
|
@ -138,7 +138,8 @@ const char* help[] = {
|
||||
#endif // AUTHENTICATION_FEATURE
|
||||
#if defined(NOTIFICATION_FEATURE)
|
||||
"[ESP600](message) - send notification",
|
||||
"[ESP610]type=(NONE/PUSHOVER/EMAIL/LINE/TELEGRAM/IFTTT/HOMEASSISTANT) (T1=xxx) (T2=xxx) "
|
||||
"[ESP610]type=(NONE/PUSHOVER/EMAIL/LINE/TELEGRAM/IFTTT/HOMEASSISTANT) "
|
||||
"(T1=xxx) (T2=xxx) "
|
||||
"(TS=xxx) - display/set Notification settings",
|
||||
"[ESP620]URL=http://XXXXXX - send GET notification",
|
||||
#endif // NOTIFICATION_FEATURE
|
||||
|
@ -63,7 +63,7 @@ void ESP3DCommands::ESP170(int cmd_params_pos, ESP3DMessage* msg) {
|
||||
"light",
|
||||
#endif // CAM_LED_PIN
|
||||
};
|
||||
bool hasError = false;
|
||||
bool hasError = false;
|
||||
String ok_msg;
|
||||
String error_msg;
|
||||
ESP3DClientType target = msg->origin;
|
||||
@ -125,8 +125,9 @@ void ESP3DCommands::ESP170(int cmd_params_pos, ESP3DMessage* msg) {
|
||||
}
|
||||
|
||||
// contrast
|
||||
if (!dispatchIdValue(json, "contrast", String(s->status.contrast).c_str(),
|
||||
target, requestId)) {
|
||||
if (!dispatchIdValue(json, "contrast",
|
||||
String(s->status.contrast).c_str(), target,
|
||||
requestId)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -151,14 +152,15 @@ void ESP3DCommands::ESP170(int cmd_params_pos, ESP3DMessage* msg) {
|
||||
}
|
||||
|
||||
// wb_mode
|
||||
if (!dispatchIdValue(json, "wb_mode", String(s->status.wb_mode).c_str(),
|
||||
target, requestId)) {
|
||||
if (!dispatchIdValue(json, "wb_mode",
|
||||
String(s->status.wb_mode).c_str(), target,
|
||||
requestId)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// awb
|
||||
if (!dispatchIdValue(json, "awb", String(s->status.awb).c_str(), target,
|
||||
requestId)) {
|
||||
if (!dispatchIdValue(json, "awb", String(s->status.awb).c_str(),
|
||||
target, requestId)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -170,8 +172,8 @@ void ESP3DCommands::ESP170(int cmd_params_pos, ESP3DMessage* msg) {
|
||||
}
|
||||
|
||||
// aec
|
||||
if (!dispatchIdValue(json, "aec", String(s->status.aec).c_str(), target,
|
||||
requestId)) {
|
||||
if (!dispatchIdValue(json, "aec", String(s->status.aec).c_str(),
|
||||
target, requestId)) {
|
||||
return;
|
||||
}
|
||||
// aec2
|
||||
@ -192,8 +194,8 @@ void ESP3DCommands::ESP170(int cmd_params_pos, ESP3DMessage* msg) {
|
||||
return;
|
||||
}
|
||||
// agc
|
||||
if (!dispatchIdValue(json, "agc", String(s->status.agc).c_str(), target,
|
||||
requestId)) {
|
||||
if (!dispatchIdValue(json, "agc", String(s->status.agc).c_str(),
|
||||
target, requestId)) {
|
||||
return;
|
||||
}
|
||||
// agc_gain
|
||||
@ -209,18 +211,19 @@ void ESP3DCommands::ESP170(int cmd_params_pos, ESP3DMessage* msg) {
|
||||
return;
|
||||
}
|
||||
// bpc
|
||||
if (!dispatchIdValue(json, "bpc", String(s->status.bpc).c_str(), target,
|
||||
requestId)) {
|
||||
if (!dispatchIdValue(json, "bpc", String(s->status.bpc).c_str(),
|
||||
target, requestId)) {
|
||||
return;
|
||||
}
|
||||
// wpc
|
||||
if (!dispatchIdValue(json, "wpc", String(s->status.wpc).c_str(), target,
|
||||
requestId)) {
|
||||
if (!dispatchIdValue(json, "wpc", String(s->status.wpc).c_str(),
|
||||
target, requestId)) {
|
||||
return;
|
||||
}
|
||||
// raw_gma
|
||||
if (!dispatchIdValue(json, "raw_gma", String(s->status.raw_gma).c_str(),
|
||||
target, requestId)) {
|
||||
if (!dispatchIdValue(json, "raw_gma",
|
||||
String(s->status.raw_gma).c_str(), target,
|
||||
requestId)) {
|
||||
return;
|
||||
}
|
||||
// lenc
|
||||
@ -234,13 +237,14 @@ void ESP3DCommands::ESP170(int cmd_params_pos, ESP3DMessage* msg) {
|
||||
return;
|
||||
}
|
||||
// hmirror
|
||||
if (!dispatchIdValue(json, "hmirror", String(s->status.hmirror).c_str(),
|
||||
target, requestId)) {
|
||||
if (!dispatchIdValue(json, "hmirror",
|
||||
String(s->status.hmirror).c_str(), target,
|
||||
requestId)) {
|
||||
return;
|
||||
}
|
||||
// dcw
|
||||
if (!dispatchIdValue(json, "dcw", String(s->status.dcw).c_str(), target,
|
||||
requestId)) {
|
||||
if (!dispatchIdValue(json, "dcw", String(s->status.dcw).c_str(),
|
||||
target, requestId)) {
|
||||
return;
|
||||
}
|
||||
// colorbar
|
||||
|
@ -48,10 +48,10 @@ void ESP3DCommands::ESP212(int cmd_params_pos, ESP3DMessage* msg) {
|
||||
#endif // AUTHENTICATION_FEATURE
|
||||
tmpstr = get_clean_param(msg, cmd_params_pos);
|
||||
tmpstr = esp3d_string::expandString(tmpstr.c_str());
|
||||
hasError = !esp3d_commands.dispatch(tmpstr.c_str(), ESP3DClientType::remote_screen,
|
||||
no_id, ESP3DMessageType::unique,
|
||||
ESP3DClientType::system,
|
||||
ESP3DAuthenticationLevel::admin);
|
||||
hasError = !esp3d_commands.dispatch(
|
||||
tmpstr.c_str(), ESP3DClientType::remote_screen, no_id,
|
||||
ESP3DMessageType::unique, ESP3DClientType::system,
|
||||
ESP3DAuthenticationLevel::admin);
|
||||
if (!dispatchAnswer(msg, COMMAND_ID, json, hasError,
|
||||
hasError ? error_msg.c_str() : ok_msg.c_str())) {
|
||||
esp3d_log_e("Error sending response to clients");
|
||||
|
@ -96,8 +96,8 @@ const char* FirmwareLabels[] = {"Unknown", "Grbl", "Marlin", "Smoothieware",
|
||||
|
||||
const char* FirmwareValues[] = {"0", "10", "20", "40", "50"};
|
||||
#ifdef NOTIFICATION_FEATURE
|
||||
const char* NotificationsLabels[] = {"none", "pushover", "email",
|
||||
"line", "telegram", "ifttt", "home-assistant"};
|
||||
const char* NotificationsLabels[] = {
|
||||
"none", "pushover", "email", "line", "telegram", "ifttt", "home-assistant"};
|
||||
|
||||
const char* NotificationsValues[] = {"0", "1", "2", "3", "4", "5", "6"};
|
||||
#endif // NOTIFICATION_FEATURE
|
||||
@ -109,8 +109,8 @@ const char* SupportedApChannelsStr[] = {"1", "2", "3", "4", "5", "6", "7",
|
||||
"8", "9", "10", "11", "12", "13", "14"};
|
||||
|
||||
const char* SupportedBaudListSizeStr[] = {
|
||||
"9600", "19200", "38400", "57600", "74880", "115200",
|
||||
"230400", "250000", "500000", "921600", "1000000", "1958400","2000000"};
|
||||
"9600", "19200", "38400", "57600", "74880", "115200", "230400",
|
||||
"250000", "500000", "921600", "1000000", "1958400", "2000000"};
|
||||
|
||||
#ifdef SENSOR_DEVICE
|
||||
|
||||
|
@ -589,7 +589,7 @@ void ESP3DCommands::ESP420(int cmd_params_pos, ESP3DMessage* msg) {
|
||||
#if COMMUNICATION_PROTOCOL == RAW_SERIAL || COMMUNICATION_PROTOCOL == MKS_SERIAL
|
||||
// serial enabled
|
||||
if (esp3d_serial_service.started()) {
|
||||
tmpstr = "ON (UART";
|
||||
tmpstr = "ON (UART";
|
||||
tmpstr += esp3d_serial_service.serialIndex();
|
||||
tmpstr += ")";
|
||||
} else {
|
||||
@ -601,7 +601,7 @@ void ESP3DCommands::ESP420(int cmd_params_pos, ESP3DMessage* msg) {
|
||||
}
|
||||
#endif // COMMUNICATION_PROTOCOL == RAW_SERIAL || COMMUNICATION_PROTOCOL ==
|
||||
// MKS_SERIAL
|
||||
#if defined (ESP_SERIAL_BRIDGE_OUTPUT)
|
||||
#if defined(ESP_SERIAL_BRIDGE_OUTPUT)
|
||||
// serial bridge enabled
|
||||
if (serial_bridge_service.started()) {
|
||||
tmpstr = "ON (UART";
|
||||
@ -610,11 +610,11 @@ void ESP3DCommands::ESP420(int cmd_params_pos, ESP3DMessage* msg) {
|
||||
} else {
|
||||
tmpstr = "OFF";
|
||||
}
|
||||
if (!dispatchIdValue(json, "serial_bridge", tmpstr.c_str(), target, requestId,
|
||||
if (!dispatchIdValue(json, "serial_bridge", tmpstr.c_str(), target, requestId,
|
||||
false)) {
|
||||
return;
|
||||
}
|
||||
#endif // ESP_SERIAL_BRIDGE_OUTPUT
|
||||
}
|
||||
#endif // ESP_SERIAL_BRIDGE_OUTPUT
|
||||
|
||||
#if defined(AUTHENTICATION_FEATURE)
|
||||
// authentication enabled
|
||||
|
@ -42,8 +42,9 @@ void ESP3DCommands::ESP610(int cmd_params_pos, ESP3DMessage* msg) {
|
||||
String tmpstr;
|
||||
const char* cmdList[] = {"type=", "T1=", "T2=", "TS="};
|
||||
uint8_t cmdListSize = sizeof(cmdList) / sizeof(char*);
|
||||
const char* notificationStr[] = {"NONE", "PUSHOVER", "EMAIL",
|
||||
"LINE", "TELEGRAM", "IFTTT", "HOMEASSISTANT"};
|
||||
const char* notificationStr[] = {"NONE", "PUSHOVER", "EMAIL",
|
||||
"LINE", "TELEGRAM", "IFTTT",
|
||||
"HOMEASSISTANT"};
|
||||
uint8_t notificationStrSize = sizeof(notificationStr) / sizeof(char*);
|
||||
const ESP3DSettingIndex settingIndex[] = {
|
||||
ESP_NOTIFICATION_TYPE, ESP_NOTIFICATION_TOKEN1, ESP_NOTIFICATION_TOKEN2,
|
||||
|
@ -20,41 +20,41 @@
|
||||
|
||||
#include "../include/esp3d_config.h"
|
||||
#if defined(ESP_BENCHMARK_FEATURE)
|
||||
#include "esp3d_benchmark.h"
|
||||
#include "../modules/websocket/websocket_server.h"
|
||||
void report_esp3d(const char * format, ...)
|
||||
{
|
||||
char buffer[64];
|
||||
char* temp = buffer;
|
||||
va_list arg;
|
||||
va_list copy;
|
||||
va_start(arg, format);
|
||||
va_copy(copy, arg);
|
||||
size_t len = vsnprintf(NULL, 0, format, arg);
|
||||
va_end(copy);
|
||||
if (len >= sizeof(buffer)) {
|
||||
temp = new char[len + 1];
|
||||
if (temp == NULL) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
len = vsnprintf(temp, len + 1, format, arg);
|
||||
String str = String("REPORT:") + String(temp);
|
||||
websocket_terminal_server.pushMSG(str.c_str());
|
||||
va_end(arg);
|
||||
if (temp != buffer) {
|
||||
delete[] temp;
|
||||
#include "esp3d_benchmark.h"
|
||||
void report_esp3d(const char* format, ...) {
|
||||
char buffer[64];
|
||||
char* temp = buffer;
|
||||
va_list arg;
|
||||
va_list copy;
|
||||
va_start(arg, format);
|
||||
va_copy(copy, arg);
|
||||
size_t len = vsnprintf(NULL, 0, format, arg);
|
||||
va_end(copy);
|
||||
if (len >= sizeof(buffer)) {
|
||||
temp = new char[len + 1];
|
||||
if (temp == NULL) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
len = vsnprintf(temp, len + 1, format, arg);
|
||||
String str = String("REPORT:") + String(temp);
|
||||
websocket_terminal_server.pushMSG(str.c_str());
|
||||
va_end(arg);
|
||||
if (temp != buffer) {
|
||||
delete[] temp;
|
||||
}
|
||||
}
|
||||
|
||||
void benchMark(const char* title, uint64_t bench_start,uint64_t bench_end, size_t bench_transfered)
|
||||
{
|
||||
float rate = 1.F * bench_transfered / (bench_end - bench_start) * 1000;
|
||||
if (rate <1024) {
|
||||
report_esp3d("REPORT: %s %llu bytes in %llu ms, %.2f bytes/s", title, bench_transfered, bench_end - bench_start, rate);
|
||||
} else {
|
||||
report_esp3d("REPORT: %s %llu bytes in %llu ms, %.2f Kbytes/s", title, bench_transfered, bench_end - bench_start, rate/1024);
|
||||
}
|
||||
|
||||
void benchMark(const char* title, uint64_t bench_start, uint64_t bench_end,
|
||||
size_t bench_transfered) {
|
||||
float rate = 1.F * bench_transfered / (bench_end - bench_start) * 1000;
|
||||
if (rate < 1024) {
|
||||
report_esp3d("REPORT: %s %llu bytes in %llu ms, %.2f bytes/s", title,
|
||||
bench_transfered, bench_end - bench_start, rate);
|
||||
} else {
|
||||
report_esp3d("REPORT: %s %llu bytes in %llu ms, %.2f Kbytes/s", title,
|
||||
bench_transfered, bench_end - bench_start, rate / 1024);
|
||||
}
|
||||
}
|
||||
#endif //ESP_BENCHMARK_FEATURE
|
||||
#endif // ESP_BENCHMARK_FEATURE
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#ifndef _BENCHMARK_ESP3D_H
|
||||
#define _BENCHMARK_ESP3D_H
|
||||
extern void benchMark(const char* title, uint64_t bench_start,uint64_t bench_end, size_t bench_transfered);
|
||||
extern void report_esp3d(const char *format, ...);
|
||||
#endif //_BENCHMARK_ESP3D_H
|
||||
extern void benchMark(const char* title, uint64_t bench_start,
|
||||
uint64_t bench_end, size_t bench_transfered);
|
||||
extern void report_esp3d(const char* format, ...);
|
||||
#endif //_BENCHMARK_ESP3D_H
|
||||
|
@ -42,8 +42,8 @@ enum class ESP3DClientType : uint8_t {
|
||||
serial_bridge = 12,
|
||||
remote_screen = 13, // target only = M117
|
||||
mks_serial = 14,
|
||||
command, // origin only
|
||||
system, // origin only
|
||||
command, // origin only
|
||||
system, // origin only
|
||||
all_clients
|
||||
};
|
||||
|
||||
|
@ -694,7 +694,7 @@ void ESP3DCommands::execute_internal_command(int cmd, int cmd_params_pos,
|
||||
break;
|
||||
// Set/Get Notification settings
|
||||
//[ESP610]type=<NONE/PUSHOVER/EMAIL/LINE/HOMEASSISTANT> T1=<token1>
|
||||
//T2=<token2>
|
||||
// T2=<token2>
|
||||
// TS=<Settings> pwd=<admin password> Get will give type and settings only
|
||||
// not the protected T1/T2
|
||||
case 610:
|
||||
@ -1109,7 +1109,7 @@ bool ESP3DCommands::formatCommand(char *cmd, size_t len) {
|
||||
cmd[sizestr + 1] = 0x0;
|
||||
return true;
|
||||
}
|
||||
if (sizestr == len && cmd[sizestr-1] == '\n'){
|
||||
if (sizestr == len && cmd[sizestr - 1] == '\n') {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -1176,7 +1176,7 @@ bool ESP3DCommands::dispatch(ESP3DMessage *msg, uint8_t *sbuf, size_t len) {
|
||||
esp3d_log_e("no msg");
|
||||
return false;
|
||||
}
|
||||
//check is need \n at the end of the command
|
||||
// check is need \n at the end of the command
|
||||
if (msg->type == ESP3DMessageType::unique ||
|
||||
msg->type == ESP3DMessageType::tail) {
|
||||
esp3d_log("unique or tail message :*%s*", (char *)sbuf);
|
||||
|
@ -27,11 +27,11 @@
|
||||
#include <soc/soc.h>
|
||||
#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2
|
||||
// FIXME : S3 not support it yet
|
||||
# if __has_include ("rtc_wdt.h")
|
||||
#if __has_include("rtc_wdt.h")
|
||||
#include <rtc_wdt.h>
|
||||
#else
|
||||
#else
|
||||
#include <soc/rtc_wdt.h>
|
||||
#endif // __has_include ("rtc_wdt.h")
|
||||
#endif // __has_include ("rtc_wdt.h")
|
||||
#endif // CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2
|
||||
#include <WiFi.h>
|
||||
#include <driver/adc.h>
|
||||
|
@ -865,7 +865,8 @@ bool ESP3DSettings::isValidIntegerSetting(uint32_t value,
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif //#if COMMUNICATION_PROTOCOL == RAW_SERIAL || COMMUNICATION_PROTOCOL == MKS_SERIAL
|
||||
#endif // #if COMMUNICATION_PROTOCOL == RAW_SERIAL || COMMUNICATION_PROTOCOL ==
|
||||
// MKS_SERIAL
|
||||
case ESP_WEBDAV_PORT:
|
||||
case ESP_HTTP_PORT:
|
||||
case ESP_TELNET_PORT:
|
||||
|
@ -28,7 +28,7 @@ const char* getContentType(const char* filename);
|
||||
const char* encodeString(const char* s);
|
||||
const char* formatBytes(uint64_t bytes);
|
||||
bool isPrintableChar(char c);
|
||||
const char * expandString(const char *s, bool formatspace = false);
|
||||
const char* expandString(const char* s, bool formatspace = false);
|
||||
} // namespace esp3d_string
|
||||
|
||||
#endif //_ESP3D_STRING_H
|
||||
|
@ -21,75 +21,47 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
//Use ESP3DLib instead of Marlin file
|
||||
// Use ESP3DLib instead of Marlin file
|
||||
#include "../esp3d_config.h"
|
||||
|
||||
//#include "../inc/MarlinConfig.h"
|
||||
//stripped version of classreader
|
||||
// #include "../inc/MarlinConfig.h"
|
||||
// stripped version of classreader
|
||||
|
||||
#if defined(SDSUPPORT) && defined (ESP3DLIB_ENV)
|
||||
#if defined(SDSUPPORT) && defined(ESP3DLIB_ENV)
|
||||
|
||||
typedef struct {
|
||||
bool saving:1,
|
||||
logging:1,
|
||||
sdprinting:1,
|
||||
sdprintdone:1,
|
||||
mounted:1,
|
||||
filenameIsDir:1,
|
||||
workDirIsRoot:1,
|
||||
abort_sd_printing:1;
|
||||
bool saving : 1, logging : 1, sdprinting : 1, sdprintdone : 1, mounted : 1,
|
||||
filenameIsDir : 1, workDirIsRoot : 1, abort_sd_printing : 1;
|
||||
} card_flags_t;
|
||||
|
||||
class CardReader {
|
||||
public:
|
||||
static card_flags_t flag; // Flags (above)
|
||||
static void mount();
|
||||
static void release();
|
||||
static bool isMounted() { return flag.mounted; }
|
||||
|
||||
static void abortFilePrintSoon() { flag.abort_sd_printing = isFileOpen(); }
|
||||
static void pauseSDPrint() { flag.sdprinting = false; }
|
||||
static bool isPrinting() { return flag.sdprinting; }
|
||||
static bool isPaused() { return isFileOpen() && !isPrinting(); }
|
||||
static bool isFileOpen() { return isMounted() && isPrinting(); }
|
||||
|
||||
class CardReader
|
||||
{
|
||||
public:
|
||||
static card_flags_t flag; // Flags (above)
|
||||
static void mount();
|
||||
static void release();
|
||||
static bool isMounted()
|
||||
{
|
||||
return flag.mounted;
|
||||
}
|
||||
|
||||
static void abortFilePrintSoon()
|
||||
{
|
||||
flag.abort_sd_printing = isFileOpen();
|
||||
}
|
||||
static void pauseSDPrint()
|
||||
{
|
||||
flag.sdprinting = false;
|
||||
}
|
||||
static bool isPrinting()
|
||||
{
|
||||
return flag.sdprinting;
|
||||
}
|
||||
static bool isPaused()
|
||||
{
|
||||
return isFileOpen() && !isPrinting();
|
||||
}
|
||||
static bool isFileOpen()
|
||||
{
|
||||
return isMounted() && isPrinting();
|
||||
}
|
||||
private:
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
|
||||
#define IS_SD_PRINTING() (card.flag.sdprinting && !card.flag.abort_sd_printing)
|
||||
#define IS_SD_FETCHING() (!card.flag.sdprintdone && IS_SD_PRINTING())
|
||||
#define IS_SD_PAUSED() card.isPaused()
|
||||
#define IS_SD_PRINTING() (card.flag.sdprinting && !card.flag.abort_sd_printing)
|
||||
#define IS_SD_FETCHING() (!card.flag.sdprintdone && IS_SD_PRINTING())
|
||||
#define IS_SD_PAUSED() card.isPaused()
|
||||
#define IS_SD_FILE_OPEN() card.isFileOpen()
|
||||
|
||||
extern CardReader card;
|
||||
|
||||
#else // !SDSUPPORT
|
||||
#else // !SDSUPPORT
|
||||
|
||||
#define IS_SD_PRINTING() false
|
||||
#define IS_SD_FETCHING() false
|
||||
#define IS_SD_PAUSED() false
|
||||
#define IS_SD_PRINTING() false
|
||||
#define IS_SD_FETCHING() false
|
||||
#define IS_SD_PAUSED() false
|
||||
#define IS_SD_FILE_OPEN() false
|
||||
|
||||
#endif // !SDSUPPORT
|
||||
#endif // !SDSUPPORT
|
||||
|
@ -40,76 +40,102 @@ typedef uint ESP3DSettingIndex;
|
||||
|
||||
// position in EEPROM / preferences will use `P_` + <position> to make a string
|
||||
// : P_0 for 0
|
||||
#define ESP_RADIO_MODE 0 // 1 byte = flag
|
||||
#define ESP_STA_SSID 1 // 33 bytes 32+1 = string ; warning does not support multibyte char like chinese
|
||||
#define ESP_STA_PASSWORD 34 // 65 bytes 64 +1 = string ;warning does not support multibyte char like chinese
|
||||
#define ESP_STA_IP_MODE 99 // 1 byte = flag
|
||||
#define ESP_STA_IP_VALUE 100 // 4 bytes xxx.xxx.xxx.xxx
|
||||
#define ESP_STA_MASK_VALUE 104 // 4 bytes xxx.xxx.xxx.xxx
|
||||
#define ESP_STA_GATEWAY_VALUE 108 // 4 bytes xxx.xxx.xxx.xxx
|
||||
#define ESP_BAUD_RATE 112 // 4 bytes = int
|
||||
#define ESP_NOTIFICATION_TYPE 116 // 1 byte = flag
|
||||
#define ESP_CALIBRATION 117 // 1 byte = flag
|
||||
#define ESP_AP_CHANNEL 118 // 1 byte = flag
|
||||
#define ESP_BUZZER 119 // 1 byte = flag
|
||||
#define ESP_INTERNET_TIME 120 // 1 byte = flag
|
||||
#define ESP_HTTP_PORT 121 // 4 bytes = int
|
||||
#define ESP_TELNET_PORT 125 // 4 bytes = int
|
||||
#define ESP_RADIO_MODE 0 // 1 byte = flag
|
||||
#define ESP_STA_SSID \
|
||||
1 // 33 bytes 32+1 = string ; warning does not support multibyte char like
|
||||
// chinese
|
||||
#define ESP_STA_PASSWORD \
|
||||
34 // 65 bytes 64 +1 = string ;warning does not support multibyte char like
|
||||
// chinese
|
||||
#define ESP_STA_IP_MODE 99 // 1 byte = flag
|
||||
#define ESP_STA_IP_VALUE 100 // 4 bytes xxx.xxx.xxx.xxx
|
||||
#define ESP_STA_MASK_VALUE 104 // 4 bytes xxx.xxx.xxx.xxx
|
||||
#define ESP_STA_GATEWAY_VALUE 108 // 4 bytes xxx.xxx.xxx.xxx
|
||||
#define ESP_BAUD_RATE 112 // 4 bytes = int
|
||||
#define ESP_NOTIFICATION_TYPE 116 // 1 byte = flag
|
||||
#define ESP_CALIBRATION 117 // 1 byte = flag
|
||||
#define ESP_AP_CHANNEL 118 // 1 byte = flag
|
||||
#define ESP_BUZZER 119 // 1 byte = flag
|
||||
#define ESP_INTERNET_TIME 120 // 1 byte = flag
|
||||
#define ESP_HTTP_PORT 121 // 4 bytes = int
|
||||
#define ESP_TELNET_PORT 125 // 4 bytes = int
|
||||
// #define FREE 129 // 1 bytes = flag
|
||||
#define ESP_HOSTNAME 130 // 33 bytes 32+1 = string ; warning does not support multibyte char like chinese
|
||||
#define ESP_SENSOR_INTERVAL 164 // 4 bytes = int
|
||||
#define ESP_SETTINGS_VERSION 168 // 8 bytes = 7+1 = string ESP3D + 2 digits
|
||||
#define ESP_ADMIN_PWD 176 // 21 bytes 20+1 = string ; warning does not support multibyte char like chinese
|
||||
#define ESP_USER_PWD 197 // 21 bytes 20+1 = string ; warning does not support multibyte char like chinese
|
||||
#define ESP_AP_SSID 218 // 33 bytes 32+1 = string ; warning does not support multibyte char like chinese
|
||||
#define ESP_AP_PASSWORD 251 // 65 bytes 64 +1 = string ;warning does not support multibyte char like chinese
|
||||
#define ESP_AP_IP_VALUE 316 // 4 bytes xxx.xxx.xxx.xxx
|
||||
#define ESP_BOOT_DELAY 320 // 4 bytes = int
|
||||
#define ESP_WEBSOCKET_PORT 324 // 4 bytes= int
|
||||
#define ESP_HTTP_ON 328 // 1 byte = flag
|
||||
#define ESP_TELNET_ON 329 // 1 byte = flag
|
||||
#define ESP_WEBSOCKET_ON 330 // 1 byte = flag
|
||||
#define ESP_SD_SPEED_DIV 331 // 1 byte = flag
|
||||
#define ESP_NOTIFICATION_TOKEN1 332 // 251 bytes 250+1 = string ; warning does not support multibyte char like chinese
|
||||
#define ESP_NOTIFICATION_TOKEN2 583 // 64 bytes 63+1 = string ; warning does not support multibyte char like chinese
|
||||
#define ESP_SENSOR_TYPE 647 // 1 bytes = flag
|
||||
#define ESP_TARGET_FW 648 // 1 bytes = flag
|
||||
#define ESP_FREE 649 // 1 bytes = flag
|
||||
#define ESP_HOSTNAME \
|
||||
130 // 33 bytes 32+1 = string ; warning does not support multibyte char like
|
||||
// chinese
|
||||
#define ESP_SENSOR_INTERVAL 164 // 4 bytes = int
|
||||
#define ESP_SETTINGS_VERSION 168 // 8 bytes = 7+1 = string ESP3D + 2 digits
|
||||
#define ESP_ADMIN_PWD \
|
||||
176 // 21 bytes 20+1 = string ; warning does not support multibyte char
|
||||
// like chinese
|
||||
#define ESP_USER_PWD \
|
||||
197 // 21 bytes 20+1 = string ; warning does not support multibyte char
|
||||
// like chinese
|
||||
#define ESP_AP_SSID \
|
||||
218 // 33 bytes 32+1 = string ; warning does not support multibyte char like
|
||||
// chinese
|
||||
#define ESP_AP_PASSWORD \
|
||||
251 // 65 bytes 64 +1 = string ;warning does not support multibyte char like
|
||||
// chinese
|
||||
#define ESP_AP_IP_VALUE 316 // 4 bytes xxx.xxx.xxx.xxx
|
||||
#define ESP_BOOT_DELAY 320 // 4 bytes = int
|
||||
#define ESP_WEBSOCKET_PORT 324 // 4 bytes= int
|
||||
#define ESP_HTTP_ON 328 // 1 byte = flag
|
||||
#define ESP_TELNET_ON 329 // 1 byte = flag
|
||||
#define ESP_WEBSOCKET_ON 330 // 1 byte = flag
|
||||
#define ESP_SD_SPEED_DIV 331 // 1 byte = flag
|
||||
#define ESP_NOTIFICATION_TOKEN1 \
|
||||
332 // 251 bytes 250+1 = string ; warning does not support multibyte char
|
||||
// like chinese
|
||||
#define ESP_NOTIFICATION_TOKEN2 \
|
||||
583 // 64 bytes 63+1 = string ; warning does not support multibyte char like
|
||||
// chinese
|
||||
#define ESP_SENSOR_TYPE 647 // 1 bytes = flag
|
||||
#define ESP_TARGET_FW 648 // 1 bytes = flag
|
||||
#define ESP_FREE 649 // 1 bytes = flag
|
||||
// #define FREE 650 // 1 bytes = flag
|
||||
#define ESP_TIME_SERVER1 651 // 129 bytes 128+1 = string ; warning does not support multibyte char like chinese
|
||||
#define ESP_TIME_SERVER2 780 // 129 bytes 128+1 = string ; warning does not support multibyte char like chinese
|
||||
#define ESP_TIME_SERVER3 909 // 129 bytes 128+1 = string ; warning does not support multibyte char like chinese
|
||||
#define ESP_TIME_SERVER1 \
|
||||
651 // 129 bytes 128+1 = string ; warning does not support multibyte char
|
||||
// like chinese
|
||||
#define ESP_TIME_SERVER2 \
|
||||
780 // 129 bytes 128+1 = string ; warning does not support multibyte char
|
||||
// like chinese
|
||||
#define ESP_TIME_SERVER3 \
|
||||
909 // 129 bytes 128+1 = string ; warning does not support multibyte char
|
||||
// like chinese
|
||||
// #define FREE 1038 // 1 bytes = flag
|
||||
#define ESP_SD_MOUNT 1039 // 1 bytes = flag
|
||||
#define ESP_SESSION_TIMEOUT 1040 // 1 bytes = flag
|
||||
#define ESP_SD_MOUNT 1039 // 1 bytes = flag
|
||||
#define ESP_SESSION_TIMEOUT 1040 // 1 bytes = flag
|
||||
// #define FREE 1041 // 1 bytes = flag
|
||||
#define ESP_SD_CHECK_UPDATE_AT_BOOT 1042 // 1 bytes = flag
|
||||
#define ESP_NOTIFICATION_SETTINGS 1043 // 129 bytes 128+1 = string ; warning does not support multibyte char like chinese
|
||||
#define ESP_CALIBRATION_1 1172 // 4 bytes = int
|
||||
#define ESP_CALIBRATION_2 1176 // 4 bytes = int
|
||||
#define ESP_CALIBRATION_3 1180 // 4 bytes = int
|
||||
#define ESP_CALIBRATION_4 1184 // 4 bytes = int
|
||||
#define ESP_CALIBRATION_5 1188 // 4 bytes = int
|
||||
#define ESP_SETUP 1192 // 1 byte = flag
|
||||
#define ESP_SD_CHECK_UPDATE_AT_BOOT 1042 // 1 bytes = flag
|
||||
#define ESP_NOTIFICATION_SETTINGS \
|
||||
1043 // 129 bytes 128+1 = string ; warning does not support multibyte char
|
||||
// like chinese
|
||||
#define ESP_CALIBRATION_1 1172 // 4 bytes = int
|
||||
#define ESP_CALIBRATION_2 1176 // 4 bytes = int
|
||||
#define ESP_CALIBRATION_3 1180 // 4 bytes = int
|
||||
#define ESP_CALIBRATION_4 1184 // 4 bytes = int
|
||||
#define ESP_CALIBRATION_5 1188 // 4 bytes = int
|
||||
#define ESP_SETUP 1192 // 1 byte = flag
|
||||
// #define FREE 1193 // 1 byte = flag
|
||||
// #define FREE 1194 // 1 byte = flag
|
||||
// #define FREE 1195 // 1 byte = flag
|
||||
#define ESP_FTP_CTRL_PORT 1196 // 4 bytes = int
|
||||
#define ESP_FTP_DATA_ACTIVE_PORT 1200 // 4 bytes = int
|
||||
#define ESP_FTP_DATA_PASSIVE_PORT 1204 // 4 bytes = int
|
||||
#define ESP_FTP_ON 1208 // 1 byte = flag
|
||||
#define ESP_AUTO_NOTIFICATION 1209 // 1 byte = flag
|
||||
#define ESP_VERBOSE_BOOT 1210 // 1 byte = flag
|
||||
#define ESP_WEBDAV_ON 1211 // 1 byte = flag
|
||||
#define ESP_WEBDAV_PORT 1212 // 4 bytes= int
|
||||
#define ESP_STA_DNS_VALUE 1216 // 4 bytes= int
|
||||
#define ESP_SECURE_SERIAL 1220 // 1 byte = flag
|
||||
#define ESP_BOOT_RADIO_STATE 1221 // 1 byte = flag
|
||||
#define ESP_STA_FALLBACK_MODE 1222 // 1 byte = flag
|
||||
#define ESP_SERIAL_BRIDGE_ON 1223 // 1 byte = flag
|
||||
#define ESP_FTP_CTRL_PORT 1196 // 4 bytes = int
|
||||
#define ESP_FTP_DATA_ACTIVE_PORT 1200 // 4 bytes = int
|
||||
#define ESP_FTP_DATA_PASSIVE_PORT 1204 // 4 bytes = int
|
||||
#define ESP_FTP_ON 1208 // 1 byte = flag
|
||||
#define ESP_AUTO_NOTIFICATION 1209 // 1 byte = flag
|
||||
#define ESP_VERBOSE_BOOT 1210 // 1 byte = flag
|
||||
#define ESP_WEBDAV_ON 1211 // 1 byte = flag
|
||||
#define ESP_WEBDAV_PORT 1212 // 4 bytes= int
|
||||
#define ESP_STA_DNS_VALUE 1216 // 4 bytes= int
|
||||
#define ESP_SECURE_SERIAL 1220 // 1 byte = flag
|
||||
#define ESP_BOOT_RADIO_STATE 1221 // 1 byte = flag
|
||||
#define ESP_STA_FALLBACK_MODE 1222 // 1 byte = flag
|
||||
#define ESP_SERIAL_BRIDGE_ON 1223 // 1 byte = flag
|
||||
// #define FREE 1224 // 1 byte = flag
|
||||
#define ESP_SERIAL_BRIDGE_BAUD 1225 // 4 bytes= int
|
||||
#define ESP_TIME_ZONE 1229 // 7 bytes 6+1 = string
|
||||
#define ESP_SERIAL_BRIDGE_BAUD 1225 // 4 bytes= int
|
||||
#define ESP_TIME_ZONE 1229 // 7 bytes 6+1 = string
|
||||
|
||||
// Hidden password
|
||||
#define HIDDEN_PASSWORD "********"
|
||||
|
@ -360,26 +360,26 @@
|
||||
#if CAMERA_DEVICE == CAMERA_MODEL_XIAO_ESP32S3
|
||||
#define CAM_PULLUP1 -1
|
||||
#define CAM_PULLUP2 -1
|
||||
#define PWDN_GPIO_NUM -1
|
||||
#define RESET_GPIO_NUM -1
|
||||
#define XCLK_GPIO_NUM 10
|
||||
#define SIOD_GPIO_NUM 40
|
||||
#define SIOC_GPIO_NUM 39
|
||||
#define PWDN_GPIO_NUM -1
|
||||
#define RESET_GPIO_NUM -1
|
||||
#define XCLK_GPIO_NUM 10
|
||||
#define SIOD_GPIO_NUM 40
|
||||
#define SIOC_GPIO_NUM 39
|
||||
|
||||
#define Y9_GPIO_NUM 48
|
||||
#define Y8_GPIO_NUM 11
|
||||
#define Y7_GPIO_NUM 12
|
||||
#define Y6_GPIO_NUM 14
|
||||
#define Y5_GPIO_NUM 16
|
||||
#define Y4_GPIO_NUM 18
|
||||
#define Y3_GPIO_NUM 17
|
||||
#define Y2_GPIO_NUM 15
|
||||
#define VSYNC_GPIO_NUM 38
|
||||
#define HREF_GPIO_NUM 47
|
||||
#define PCLK_GPIO_NUM 13
|
||||
#define Y9_GPIO_NUM 48
|
||||
#define Y8_GPIO_NUM 11
|
||||
#define Y7_GPIO_NUM 12
|
||||
#define Y6_GPIO_NUM 14
|
||||
#define Y5_GPIO_NUM 16
|
||||
#define Y4_GPIO_NUM 18
|
||||
#define Y3_GPIO_NUM 17
|
||||
#define Y2_GPIO_NUM 15
|
||||
#define VSYNC_GPIO_NUM 38
|
||||
#define HREF_GPIO_NUM 47
|
||||
#define PCLK_GPIO_NUM 13
|
||||
|
||||
#define CAM_LED_PIN -1
|
||||
#endif // CAMERA_MODEL_XIAO_ESP32S3
|
||||
#define CAM_LED_PIN -1
|
||||
#endif // CAMERA_MODEL_XIAO_ESP32S3
|
||||
|
||||
#if CAMERA_DEVICE == CAMERA_MODEL_UICPAL_ESP32S3
|
||||
#define CAM_LED_PIN -1
|
||||
|
@ -41,7 +41,7 @@
|
||||
#if ESP_LOG_FEATURE == ESP_SERIAL_OUTPUT
|
||||
#if not defined(ESP_NO_SANITY_CHECK)
|
||||
#warning You use same serial for output and log
|
||||
#endif // SANITY_ESP3D_H
|
||||
#endif // SANITY_ESP3D_H
|
||||
#endif // ESP_LOG_FEATURE == ESP_SERIAL_OUTPUT
|
||||
#if (ESP_LOG_FEATURE == LOG_OUTPUT_SERIAL2) && defined(ARDUINO_ARCH_ESP8266)
|
||||
#error Serial 2 is not available in ESP8266 for log
|
||||
@ -92,17 +92,20 @@
|
||||
/**************************
|
||||
* Hooks
|
||||
* ***********************/
|
||||
#if defined(ESP_AUTOSTART_SCRIPT) || defined(ESP_AUTOSTART_SCRIPT_FILE) || defined(ESP_GOT_IP_HOOK) || defined(ESP_GOT_DATE_TIME_HOOK)
|
||||
#if defined(ESP_AUTOSTART_SCRIPT) || defined(ESP_AUTOSTART_SCRIPT_FILE) || \
|
||||
defined(ESP_GOT_IP_HOOK) || defined(ESP_GOT_DATE_TIME_HOOK)
|
||||
#ifndef GCODE_HOST_FEATURE
|
||||
#error GCODE_HOST_FEATURE is necessary for ESP_AUTOSTART_SCRIPT/ESP_AUTOSTART_SCRIPT_FILE/ESP_GOT_IP_HOOK/ESP_GOT_DATE_TIME_HOOK
|
||||
#endif //ifndef GCODE_HOST_FEATURE
|
||||
#endif //#if defined(ESP_AUTOSTART_SCRIPT) || defined(ESP_AUTOSTART_SCRIPT_FILE) || defined(ESP_GOT_IP_HOOK) || defined(ESP_GOT_DATE_TIME_HOOK)
|
||||
#endif // ifndef GCODE_HOST_FEATURE
|
||||
#endif // #if defined(ESP_AUTOSTART_SCRIPT) ||
|
||||
// defined(ESP_AUTOSTART_SCRIPT_FILE) || defined(ESP_GOT_IP_HOOK) ||
|
||||
// defined(ESP_GOT_DATE_TIME_HOOK)
|
||||
|
||||
#if defined(ESP_GOT_IP_HOOK) || defined(ESP_GOT_DATE_TIME_HOOK)
|
||||
#if !defined(WIFI_FEATURE) && !defined(ETH_FEATURE)
|
||||
#error Hooks need at least one network defined (WIFI_FEATURE or ETH_FEATURE)
|
||||
#endif //!defined(WIFI_FEATURE) && !defined(ETH_FEATURE)
|
||||
#endif //#if defined(ESP_GOT_IP_HOOK) || defined(ESP_GOT_DATE_TIME_HOOK)
|
||||
#error Hooks need at least one network defined (WIFI_FEATURE or ETH_FEATURE)
|
||||
#endif //! defined(WIFI_FEATURE) && !defined(ETH_FEATURE)
|
||||
#endif // #if defined(ESP_GOT_IP_HOOK) || defined(ESP_GOT_DATE_TIME_HOOK)
|
||||
|
||||
/**************************
|
||||
* Filesystem
|
||||
@ -195,4 +198,3 @@
|
||||
#endif
|
||||
|
||||
#endif // SANITY_CHECK
|
||||
|
||||
|
@ -70,7 +70,8 @@ class AuthenticationService {
|
||||
static bool ClearCurrentHttpSession();
|
||||
static bool ClearAllSessions();
|
||||
static bool CreateSession(ESP3DAuthenticationLevel auth_level,
|
||||
ESP3DClientType client_type, const char *session_ID);
|
||||
ESP3DClientType client_type,
|
||||
const char *session_ID);
|
||||
#endif // HTTP_FEATURE
|
||||
private:
|
||||
static String _adminpwd;
|
||||
|
@ -73,7 +73,7 @@ void BootDelay::handle() {
|
||||
ESP3DRequest reqId = {
|
||||
.id = ESP_OUTPUT_PROGRESS,
|
||||
};
|
||||
#endif // DISPLAY_DEVICE
|
||||
#endif // DISPLAY_DEVICE
|
||||
while ((millis() - _startdelay) < _totalduration) {
|
||||
#if defined(RECOVERY_FEATURE)
|
||||
recovery_service.handle();
|
||||
|
@ -19,40 +19,36 @@
|
||||
*/
|
||||
#ifndef _BUZZER_H
|
||||
#define _BUZZER_H
|
||||
#define BEEP_FREQUENCY 3000
|
||||
#define BEEP_FREQUENCY 3000
|
||||
|
||||
struct tone_data {
|
||||
int frequency;
|
||||
int duration;
|
||||
bool processing;
|
||||
tone_data * _next;
|
||||
int frequency;
|
||||
int duration;
|
||||
bool processing;
|
||||
tone_data* _next;
|
||||
};
|
||||
|
||||
class BuzzerDevice
|
||||
{
|
||||
public:
|
||||
BuzzerDevice();
|
||||
~BuzzerDevice();
|
||||
void playsound(int frequency, int duration);
|
||||
bool started()
|
||||
{
|
||||
return _started;
|
||||
}
|
||||
bool begin();
|
||||
void end();
|
||||
void handle();
|
||||
tone_data * getNextTone();
|
||||
bool isPlaying();
|
||||
void waitWhilePlaying();
|
||||
void beep(int count=1, int delay = 0, int frequency = BEEP_FREQUENCY);
|
||||
private:
|
||||
tone_data * _head;
|
||||
tone_data * _tail;
|
||||
bool _started;
|
||||
void purgeData();
|
||||
bool addToneToList(int frequency, int duration);
|
||||
void no_tone();
|
||||
class BuzzerDevice {
|
||||
public:
|
||||
BuzzerDevice();
|
||||
~BuzzerDevice();
|
||||
void playsound(int frequency, int duration);
|
||||
bool started() { return _started; }
|
||||
bool begin();
|
||||
void end();
|
||||
void handle();
|
||||
tone_data* getNextTone();
|
||||
bool isPlaying();
|
||||
void waitWhilePlaying();
|
||||
void beep(int count = 1, int delay = 0, int frequency = BEEP_FREQUENCY);
|
||||
|
||||
private:
|
||||
tone_data* _head;
|
||||
tone_data* _tail;
|
||||
bool _started;
|
||||
void purgeData();
|
||||
bool addToneToList(int frequency, int duration);
|
||||
void no_tone();
|
||||
};
|
||||
extern BuzzerDevice esp3d_buzzer;
|
||||
#endif //_BUZZER_H
|
||||
#endif //_BUZZER_H
|
||||
|
@ -18,40 +18,32 @@
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef _CAMERA_H
|
||||
#define _CAMERA_H
|
||||
#include <WebServer.h>
|
||||
|
||||
class Camera
|
||||
{
|
||||
public:
|
||||
Camera();
|
||||
~Camera();
|
||||
bool begin();
|
||||
void end();
|
||||
bool initHardware();
|
||||
bool stopHardware();
|
||||
bool handle_snap(WebServer * webserver, const char *path=NULL, const char* filename=NULL);
|
||||
void handle();
|
||||
int command(const char * param, const char * value);
|
||||
uint8_t GetModel();
|
||||
const char *GetModelString();
|
||||
bool started()
|
||||
{
|
||||
return _started;
|
||||
}
|
||||
bool isinitialised()
|
||||
{
|
||||
return _initialised;
|
||||
}
|
||||
private:
|
||||
bool _initialised;
|
||||
bool _started;
|
||||
class Camera {
|
||||
public:
|
||||
Camera();
|
||||
~Camera();
|
||||
bool begin();
|
||||
void end();
|
||||
bool initHardware();
|
||||
bool stopHardware();
|
||||
bool handle_snap(WebServer *webserver, const char *path = NULL,
|
||||
const char *filename = NULL);
|
||||
void handle();
|
||||
int command(const char *param, const char *value);
|
||||
uint8_t GetModel();
|
||||
const char *GetModelString();
|
||||
bool started() { return _started; }
|
||||
bool isinitialised() { return _initialised; }
|
||||
|
||||
private:
|
||||
bool _initialised;
|
||||
bool _started;
|
||||
};
|
||||
|
||||
extern Camera esp3d_camera;
|
||||
|
||||
#endif //_CAMERA_H
|
||||
|
||||
#endif //_CAMERA_H
|
||||
|
@ -18,21 +18,17 @@
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef _DEVICES_SERVICES_H
|
||||
#define _DEVICES_SERVICES_H
|
||||
|
||||
class DevicesServices {
|
||||
public:
|
||||
static bool begin();
|
||||
static void end();
|
||||
static void handle();
|
||||
|
||||
class DevicesServices
|
||||
{
|
||||
public:
|
||||
static bool begin();
|
||||
static void end();
|
||||
static void handle();
|
||||
private:
|
||||
static bool _started;
|
||||
private:
|
||||
static bool _started;
|
||||
};
|
||||
|
||||
#endif //_DEVICES_SERVICES_H
|
||||
|
||||
#endif //_DEVICES_SERVICES_H
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#define ESP3D_Logo_width 62
|
||||
#define ESP3D_Logo_height 45
|
||||
const uint8_t ESP3D_Logo[] PROGMEM = {
|
||||
const uint8_t ESP3D_Logo[] PROGMEM = {
|
||||
0x00, 0x00, 0x00, 0xFE, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF,
|
||||
0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0xFF, 0x01, 0x00, 0x00,
|
||||
0x00, 0x00, 0xF8, 0xFF, 0xFF, 0x07, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFF,
|
||||
@ -56,4 +56,4 @@ const uint8_t ESP3D_Logo[] PROGMEM = {
|
||||
0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x1F, 0x00, 0x00, 0x00,
|
||||
};
|
||||
|
||||
#endif //_esp3d_logo_h
|
||||
#endif //_esp3d_logo_h
|
||||
|
@ -18,34 +18,34 @@
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
//Screen size
|
||||
#define SCREEN_WIDTH 128
|
||||
#define SCREEN_HEIGHT 64
|
||||
//Colors
|
||||
#define COLOR_BLACK BLACK
|
||||
#define COLOR_WHITE WHITE
|
||||
#define SPLASH_FG COLOR_BLACK
|
||||
#define SPLASH_BG COLOR_WHITE
|
||||
#define SCREEN_BG COLOR_BLACK
|
||||
// Screen size
|
||||
#define SCREEN_WIDTH 128
|
||||
#define SCREEN_HEIGHT 64
|
||||
// Colors
|
||||
#define COLOR_BLACK BLACK
|
||||
#define COLOR_WHITE WHITE
|
||||
#define SPLASH_FG COLOR_BLACK
|
||||
#define SPLASH_BG COLOR_WHITE
|
||||
#define SCREEN_BG COLOR_BLACK
|
||||
#define PROGRESS_FG COLOR_WHITE
|
||||
#define SIGNAL_FG COLOR_WHITE
|
||||
#define SIGNAL_FG COLOR_WHITE
|
||||
#define SSID_FG COLOR_WHITE
|
||||
#define IP_FG COLOR_WHITE
|
||||
#define STATUS_FG COLOR_WHITE
|
||||
#define IP_FG COLOR_WHITE
|
||||
#define STATUS_FG COLOR_WHITE
|
||||
|
||||
//Fonts
|
||||
#define FONTSIGNAL 2
|
||||
#define FONTSSID 2
|
||||
#define FONTIP 3
|
||||
#define FONTSTATUS 2
|
||||
// Fonts
|
||||
#define FONTSIGNAL 2
|
||||
#define FONTSSID 2
|
||||
#define FONTIP 3
|
||||
#define FONTSTATUS 2
|
||||
|
||||
//Positions
|
||||
#define SIGNAL_X SCREEN_WIDTH-27
|
||||
// Positions
|
||||
#define SIGNAL_X SCREEN_WIDTH - 27
|
||||
#define SIGNAL_Y 0
|
||||
#define SIGNAL_W 46
|
||||
#define SIGNAL_H 12
|
||||
|
||||
#define SIGNAL_ICON_X SCREEN_WIDTH-43
|
||||
#define SIGNAL_ICON_X SCREEN_WIDTH - 43
|
||||
#define SIGNAL_ICON_Y 2
|
||||
#define SIGNAL_ICON_W 15
|
||||
#define SIGNAL_ICON_H 10
|
||||
@ -63,6 +63,6 @@
|
||||
#define IP_AREA_H 16
|
||||
|
||||
#define STATUS_AREA_X 0
|
||||
#define STATUS_AREA_Y SCREEN_HEIGHT-16
|
||||
#define STATUS_AREA_Y SCREEN_HEIGHT - 16
|
||||
#define STATUS_AREA_W SCREEN_WIDTH
|
||||
#define STATUS_AREA_H 16
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#define ESP3D_Logo_width 62
|
||||
#define ESP3D_Logo_height 45
|
||||
const uint8_t ESP3D_Logo[] PROGMEM = {
|
||||
const uint8_t ESP3D_Logo[] PROGMEM = {
|
||||
0x00, 0x00, 0x00, 0xFE, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF,
|
||||
0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0xFF, 0x01, 0x00, 0x00,
|
||||
0x00, 0x00, 0xF8, 0xFF, 0xFF, 0x07, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFF,
|
||||
@ -56,4 +56,4 @@ const uint8_t ESP3D_Logo[] PROGMEM = {
|
||||
0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x1F, 0x00, 0x00, 0x00,
|
||||
};
|
||||
|
||||
#endif //_esp3d_logo_h
|
||||
#endif //_esp3d_logo_h
|
||||
|
@ -18,34 +18,34 @@
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
//Screen size
|
||||
#define SCREEN_WIDTH 132
|
||||
#define SCREEN_HEIGHT 64
|
||||
//Colors
|
||||
#define COLOR_BLACK BLACK
|
||||
#define COLOR_WHITE WHITE
|
||||
#define SPLASH_FG COLOR_BLACK
|
||||
#define SPLASH_BG COLOR_WHITE
|
||||
#define SCREEN_BG COLOR_BLACK
|
||||
// Screen size
|
||||
#define SCREEN_WIDTH 132
|
||||
#define SCREEN_HEIGHT 64
|
||||
// Colors
|
||||
#define COLOR_BLACK BLACK
|
||||
#define COLOR_WHITE WHITE
|
||||
#define SPLASH_FG COLOR_BLACK
|
||||
#define SPLASH_BG COLOR_WHITE
|
||||
#define SCREEN_BG COLOR_BLACK
|
||||
#define PROGRESS_FG COLOR_WHITE
|
||||
#define SIGNAL_FG COLOR_WHITE
|
||||
#define SIGNAL_FG COLOR_WHITE
|
||||
#define SSID_FG COLOR_WHITE
|
||||
#define IP_FG COLOR_WHITE
|
||||
#define STATUS_FG COLOR_WHITE
|
||||
#define IP_FG COLOR_WHITE
|
||||
#define STATUS_FG COLOR_WHITE
|
||||
|
||||
//Fonts
|
||||
// Fonts
|
||||
#define FONTSIGNAL 2
|
||||
#define FONTSSID 2
|
||||
#define FONTIP 3
|
||||
#define FONTSTATUS 2
|
||||
#define FONTSSID 2
|
||||
#define FONTIP 3
|
||||
#define FONTSTATUS 2
|
||||
|
||||
//Positions
|
||||
#define SIGNAL_X 132-27
|
||||
// Positions
|
||||
#define SIGNAL_X 132 - 27
|
||||
#define SIGNAL_Y 0
|
||||
#define SIGNAL_W 46
|
||||
#define SIGNAL_H 10
|
||||
|
||||
#define SIGNAL_ICON_X 132-43
|
||||
#define SIGNAL_ICON_X 132 - 43
|
||||
#define SIGNAL_ICON_Y 2
|
||||
#define SIGNAL_ICON_W 15
|
||||
#define SIGNAL_ICON_H 10
|
||||
|
@ -23,97 +23,97 @@
|
||||
|
||||
#define ESP3D_Logo_width 100
|
||||
#define ESP3D_Logo_height 83
|
||||
const uint8_t ESP3D_Logo[] PROGMEM = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA0,
|
||||
0x4B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xFE, 0xFF, 0x0B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xE0, 0xFF, 0xFF, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0xF8, 0xFF, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xFE, 0xFF, 0xFF, 0xFF, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0xC0, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xAE, 0xDD, 0xDD, 0xF7,
|
||||
0x79, 0xBB, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x04,
|
||||
0x48, 0x48, 0x10, 0x81, 0x44, 0x10, 0x08, 0x00, 0x00, 0x00, 0xD0, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x9F, 0x00, 0x00, 0x00, 0xF8,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x21, 0x22, 0xF8, 0x01, 0x00, 0x00,
|
||||
0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x00, 0x00, 0x80, 0x03, 0x00,
|
||||
0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00, 0x0E,
|
||||
0x00, 0x80, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00,
|
||||
0x1C, 0x00, 0xC0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00,
|
||||
0x00, 0x30, 0x00, 0xE0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x00, 0x00,
|
||||
0x00, 0x00, 0x20, 0x00, 0xE0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x3F, 0x00,
|
||||
0x00, 0x00, 0x00, 0x60, 0x00, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x3F,
|
||||
0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0xF0, 0xFF, 0xFF, 0xFB, 0xFF, 0xFF,
|
||||
0x1F, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x78, 0x00, 0x7C, 0x80, 0x0F,
|
||||
0xC0, 0x1F, 0xF0, 0x07, 0xE8, 0x0F, 0x80, 0x00, 0x78, 0x00, 0x3C, 0x80,
|
||||
0x0F, 0x00, 0x0F, 0xF8, 0x1F, 0xFC, 0x3F, 0x80, 0x01, 0x78, 0x00, 0x1C,
|
||||
0x08, 0x0F, 0x00, 0x1F, 0xFC, 0x1F, 0xFC, 0xFF, 0x80, 0x00, 0x78, 0xF8,
|
||||
0x1F, 0x7E, 0x0F, 0x1F, 0x0E, 0x1C, 0x3E, 0xBC, 0xFE, 0x81, 0x01, 0x78,
|
||||
0xF8, 0x1F, 0xFE, 0x0F, 0x1F, 0x0E, 0x00, 0x3E, 0x7C, 0xF0, 0x81, 0x01,
|
||||
0x78, 0xF8, 0x1F, 0xFE, 0x1F, 0x3F, 0x0E, 0x00, 0x3C, 0x3C, 0xE0, 0x83,
|
||||
0x01, 0x78, 0xF8, 0x1F, 0xFE, 0x0F, 0x1F, 0x0C, 0x00, 0x3E, 0x3C, 0xC0,
|
||||
0x03, 0x01, 0x7C, 0xF8, 0x1F, 0xF0, 0x0F, 0x1F, 0x0E, 0x00, 0x1F, 0x3C,
|
||||
0xC0, 0x83, 0x01, 0x78, 0x00, 0x3E, 0xC0, 0x0F, 0x1F, 0x1E, 0xF0, 0x0F,
|
||||
0x7C, 0xC0, 0x87, 0x01, 0x7C, 0x00, 0x7E, 0x80, 0x1F, 0x0A, 0x0F, 0xF8,
|
||||
0x0F, 0x7C, 0xC0, 0x07, 0x01, 0x78, 0x98, 0xFF, 0x01, 0x0F, 0x00, 0x0F,
|
||||
0xF0, 0x1F, 0x3C, 0x80, 0x83, 0x01, 0x78, 0xF8, 0xFF, 0x07, 0x0E, 0xC0,
|
||||
0x0F, 0x80, 0x3E, 0x3C, 0xC0, 0x87, 0x01, 0x78, 0xF8, 0xFF, 0x0F, 0x0E,
|
||||
0xFA, 0x1F, 0x00, 0x7E, 0x3C, 0xC0, 0x03, 0x01, 0x78, 0xF8, 0xFF, 0x1F,
|
||||
0x0E, 0xFF, 0x0F, 0x00, 0x7C, 0x3C, 0xC0, 0x83, 0x01, 0x7C, 0xF8, 0xFF,
|
||||
0x1F, 0x0E, 0xFF, 0x1F, 0x00, 0x7C, 0x7C, 0xE0, 0x83, 0x01, 0x78, 0xF8,
|
||||
0xDF, 0x0F, 0x0F, 0xFF, 0x0F, 0x00, 0x7C, 0x3C, 0xF0, 0x03, 0x01, 0x78,
|
||||
0x10, 0x0D, 0x04, 0x0F, 0xFF, 0x0F, 0x5C, 0x3F, 0xFC, 0xFF, 0x80, 0x01,
|
||||
0x78, 0x00, 0x0C, 0x00, 0x0F, 0xFF, 0x0F, 0xFC, 0x3F, 0xFC, 0xFF, 0x80,
|
||||
0x01, 0x78, 0x00, 0x1C, 0xC0, 0x0F, 0xFF, 0x0F, 0xFC, 0x0F, 0xFC, 0x3F,
|
||||
0x80, 0x00, 0xF8, 0xEB, 0xFF, 0xF9, 0xFF, 0xFF, 0x07, 0xF8, 0x07, 0xB8,
|
||||
0x07, 0x80, 0x00, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x07, 0x00, 0x00,
|
||||
0x00, 0x00, 0xC0, 0x00, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x07, 0x00,
|
||||
0x00, 0x00, 0x00, 0xC0, 0x00, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x03,
|
||||
0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0xE0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0x01, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0xC0, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0x01, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0xC0, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0xFE,
|
||||
0xFF, 0xFF, 0xFF, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00,
|
||||
0xFC, 0xFF, 0xFF, 0xFF, 0x07, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x03, 0x00,
|
||||
0x00, 0xF0, 0xFF, 0xFF, 0xFF, 0xA3, 0xD7, 0x7A, 0xAD, 0xE7, 0x79, 0x00,
|
||||
0x00, 0x00, 0x40, 0xFE, 0xFB, 0xBF, 0xFF, 0x7D, 0xDF, 0xF7, 0x7D, 0x1F,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x24, 0x49, 0x92, 0x24,
|
||||
0x91, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xE0, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0xC0, 0xFF, 0xFF, 0xFF, 0xFF, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0xFC, 0xFF, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0x1F, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF4, 0xFF, 0x02, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
const uint8_t ESP3D_Logo[] PROGMEM = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA0,
|
||||
0x4B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xFE, 0xFF, 0x0B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xE0, 0xFF, 0xFF, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0xF8, 0xFF, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xFE, 0xFF, 0xFF, 0xFF, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0xC0, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xAE, 0xDD, 0xDD, 0xF7,
|
||||
0x79, 0xBB, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x04,
|
||||
0x48, 0x48, 0x10, 0x81, 0x44, 0x10, 0x08, 0x00, 0x00, 0x00, 0xD0, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x9F, 0x00, 0x00, 0x00, 0xF8,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x21, 0x22, 0xF8, 0x01, 0x00, 0x00,
|
||||
0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x00, 0x00, 0x80, 0x03, 0x00,
|
||||
0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00, 0x0E,
|
||||
0x00, 0x80, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00,
|
||||
0x1C, 0x00, 0xC0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00,
|
||||
0x00, 0x30, 0x00, 0xE0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x00, 0x00,
|
||||
0x00, 0x00, 0x20, 0x00, 0xE0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x3F, 0x00,
|
||||
0x00, 0x00, 0x00, 0x60, 0x00, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x3F,
|
||||
0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0xF0, 0xFF, 0xFF, 0xFB, 0xFF, 0xFF,
|
||||
0x1F, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x78, 0x00, 0x7C, 0x80, 0x0F,
|
||||
0xC0, 0x1F, 0xF0, 0x07, 0xE8, 0x0F, 0x80, 0x00, 0x78, 0x00, 0x3C, 0x80,
|
||||
0x0F, 0x00, 0x0F, 0xF8, 0x1F, 0xFC, 0x3F, 0x80, 0x01, 0x78, 0x00, 0x1C,
|
||||
0x08, 0x0F, 0x00, 0x1F, 0xFC, 0x1F, 0xFC, 0xFF, 0x80, 0x00, 0x78, 0xF8,
|
||||
0x1F, 0x7E, 0x0F, 0x1F, 0x0E, 0x1C, 0x3E, 0xBC, 0xFE, 0x81, 0x01, 0x78,
|
||||
0xF8, 0x1F, 0xFE, 0x0F, 0x1F, 0x0E, 0x00, 0x3E, 0x7C, 0xF0, 0x81, 0x01,
|
||||
0x78, 0xF8, 0x1F, 0xFE, 0x1F, 0x3F, 0x0E, 0x00, 0x3C, 0x3C, 0xE0, 0x83,
|
||||
0x01, 0x78, 0xF8, 0x1F, 0xFE, 0x0F, 0x1F, 0x0C, 0x00, 0x3E, 0x3C, 0xC0,
|
||||
0x03, 0x01, 0x7C, 0xF8, 0x1F, 0xF0, 0x0F, 0x1F, 0x0E, 0x00, 0x1F, 0x3C,
|
||||
0xC0, 0x83, 0x01, 0x78, 0x00, 0x3E, 0xC0, 0x0F, 0x1F, 0x1E, 0xF0, 0x0F,
|
||||
0x7C, 0xC0, 0x87, 0x01, 0x7C, 0x00, 0x7E, 0x80, 0x1F, 0x0A, 0x0F, 0xF8,
|
||||
0x0F, 0x7C, 0xC0, 0x07, 0x01, 0x78, 0x98, 0xFF, 0x01, 0x0F, 0x00, 0x0F,
|
||||
0xF0, 0x1F, 0x3C, 0x80, 0x83, 0x01, 0x78, 0xF8, 0xFF, 0x07, 0x0E, 0xC0,
|
||||
0x0F, 0x80, 0x3E, 0x3C, 0xC0, 0x87, 0x01, 0x78, 0xF8, 0xFF, 0x0F, 0x0E,
|
||||
0xFA, 0x1F, 0x00, 0x7E, 0x3C, 0xC0, 0x03, 0x01, 0x78, 0xF8, 0xFF, 0x1F,
|
||||
0x0E, 0xFF, 0x0F, 0x00, 0x7C, 0x3C, 0xC0, 0x83, 0x01, 0x7C, 0xF8, 0xFF,
|
||||
0x1F, 0x0E, 0xFF, 0x1F, 0x00, 0x7C, 0x7C, 0xE0, 0x83, 0x01, 0x78, 0xF8,
|
||||
0xDF, 0x0F, 0x0F, 0xFF, 0x0F, 0x00, 0x7C, 0x3C, 0xF0, 0x03, 0x01, 0x78,
|
||||
0x10, 0x0D, 0x04, 0x0F, 0xFF, 0x0F, 0x5C, 0x3F, 0xFC, 0xFF, 0x80, 0x01,
|
||||
0x78, 0x00, 0x0C, 0x00, 0x0F, 0xFF, 0x0F, 0xFC, 0x3F, 0xFC, 0xFF, 0x80,
|
||||
0x01, 0x78, 0x00, 0x1C, 0xC0, 0x0F, 0xFF, 0x0F, 0xFC, 0x0F, 0xFC, 0x3F,
|
||||
0x80, 0x00, 0xF8, 0xEB, 0xFF, 0xF9, 0xFF, 0xFF, 0x07, 0xF8, 0x07, 0xB8,
|
||||
0x07, 0x80, 0x00, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x07, 0x00, 0x00,
|
||||
0x00, 0x00, 0xC0, 0x00, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x07, 0x00,
|
||||
0x00, 0x00, 0x00, 0xC0, 0x00, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x03,
|
||||
0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0xE0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0x01, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0xC0, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0x01, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0xC0, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0xFE,
|
||||
0xFF, 0xFF, 0xFF, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00,
|
||||
0xFC, 0xFF, 0xFF, 0xFF, 0x07, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x03, 0x00,
|
||||
0x00, 0xF0, 0xFF, 0xFF, 0xFF, 0xA3, 0xD7, 0x7A, 0xAD, 0xE7, 0x79, 0x00,
|
||||
0x00, 0x00, 0x40, 0xFE, 0xFB, 0xBF, 0xFF, 0x7D, 0xDF, 0xF7, 0x7D, 0x1F,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x24, 0x49, 0x92, 0x24,
|
||||
0x91, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xE0, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0xC0, 0xFF, 0xFF, 0xFF, 0xFF, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0xFC, 0xFF, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0x1F, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF4, 0xFF, 0x02, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
|
||||
#endif //_esp3d_logo_h
|
||||
#endif //_esp3d_logo_h
|
||||
|
@ -18,35 +18,35 @@
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
//Screen size
|
||||
#define SCREEN_WIDTH 240
|
||||
#define SCREEN_HEIGHT 135
|
||||
// Screen size
|
||||
#define SCREEN_WIDTH 240
|
||||
#define SCREEN_HEIGHT 135
|
||||
|
||||
//Colors
|
||||
#define COLOR_BLACK TFT_BLACK
|
||||
#define COLOR_WHITE TFT_WHITE
|
||||
#define SPLASH_FG COLOR_WHITE
|
||||
#define SPLASH_BG COLOR_BLACK
|
||||
#define SCREEN_BG COLOR_BLACK
|
||||
// Colors
|
||||
#define COLOR_BLACK TFT_BLACK
|
||||
#define COLOR_WHITE TFT_WHITE
|
||||
#define SPLASH_FG COLOR_WHITE
|
||||
#define SPLASH_BG COLOR_BLACK
|
||||
#define SCREEN_BG COLOR_BLACK
|
||||
#define PROGRESS_FG TFT_BLUE
|
||||
#define SIGNAL_FG TFT_CYAN
|
||||
#define SIGNAL_FG TFT_CYAN
|
||||
#define SSID_FG TFT_ORANGE
|
||||
#define IP_FG COLOR_WHITE
|
||||
#define STATUS_FG TFT_YELLOW
|
||||
#define IP_FG COLOR_WHITE
|
||||
#define STATUS_FG TFT_YELLOW
|
||||
|
||||
//Fonts
|
||||
#define FONTSIGNAL 2
|
||||
#define FONTSSID 2
|
||||
#define FONTIP 4
|
||||
#define FONTSTATUS 2
|
||||
// Fonts
|
||||
#define FONTSIGNAL 2
|
||||
#define FONTSSID 2
|
||||
#define FONTIP 4
|
||||
#define FONTSTATUS 2
|
||||
|
||||
//Positions
|
||||
#define SIGNAL_X SCREEN_WIDTH-34
|
||||
// Positions
|
||||
#define SIGNAL_X SCREEN_WIDTH - 34
|
||||
#define SIGNAL_Y 0
|
||||
#define SIGNAL_W 46
|
||||
#define SIGNAL_H 14
|
||||
|
||||
#define SIGNAL_ICON_X SCREEN_WIDTH-60
|
||||
#define SIGNAL_ICON_X SCREEN_WIDTH - 60
|
||||
#define SIGNAL_ICON_Y 2
|
||||
#define SIGNAL_ICON_W 23
|
||||
#define SIGNAL_ICON_H 10
|
||||
@ -59,11 +59,11 @@
|
||||
#define SSID_AREA_H 14
|
||||
|
||||
#define IP_AREA_X 0
|
||||
#define IP_AREA_Y (SCREEN_HEIGHT/2) - 8
|
||||
#define IP_AREA_Y (SCREEN_HEIGHT / 2) - 8
|
||||
#define IP_AREA_W SCREEN_WIDTH
|
||||
#define IP_AREA_H 20
|
||||
|
||||
#define STATUS_AREA_X 0
|
||||
#define STATUS_AREA_Y SCREEN_HEIGHT-16
|
||||
#define STATUS_AREA_Y SCREEN_HEIGHT - 16
|
||||
#define STATUS_AREA_W SCREEN_WIDTH
|
||||
#define STATUS_AREA_H 16
|
||||
|
@ -23,97 +23,97 @@
|
||||
|
||||
#define ESP3D_Logo_width 100
|
||||
#define ESP3D_Logo_height 83
|
||||
const uint8_t ESP3D_Logo[] PROGMEM = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA0,
|
||||
0x4B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xFE, 0xFF, 0x0B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xE0, 0xFF, 0xFF, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0xF8, 0xFF, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xFE, 0xFF, 0xFF, 0xFF, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0xC0, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xAE, 0xDD, 0xDD, 0xF7,
|
||||
0x79, 0xBB, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x04,
|
||||
0x48, 0x48, 0x10, 0x81, 0x44, 0x10, 0x08, 0x00, 0x00, 0x00, 0xD0, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x9F, 0x00, 0x00, 0x00, 0xF8,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x21, 0x22, 0xF8, 0x01, 0x00, 0x00,
|
||||
0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x00, 0x00, 0x80, 0x03, 0x00,
|
||||
0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00, 0x0E,
|
||||
0x00, 0x80, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00,
|
||||
0x1C, 0x00, 0xC0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00,
|
||||
0x00, 0x30, 0x00, 0xE0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x00, 0x00,
|
||||
0x00, 0x00, 0x20, 0x00, 0xE0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x3F, 0x00,
|
||||
0x00, 0x00, 0x00, 0x60, 0x00, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x3F,
|
||||
0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0xF0, 0xFF, 0xFF, 0xFB, 0xFF, 0xFF,
|
||||
0x1F, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x78, 0x00, 0x7C, 0x80, 0x0F,
|
||||
0xC0, 0x1F, 0xF0, 0x07, 0xE8, 0x0F, 0x80, 0x00, 0x78, 0x00, 0x3C, 0x80,
|
||||
0x0F, 0x00, 0x0F, 0xF8, 0x1F, 0xFC, 0x3F, 0x80, 0x01, 0x78, 0x00, 0x1C,
|
||||
0x08, 0x0F, 0x00, 0x1F, 0xFC, 0x1F, 0xFC, 0xFF, 0x80, 0x00, 0x78, 0xF8,
|
||||
0x1F, 0x7E, 0x0F, 0x1F, 0x0E, 0x1C, 0x3E, 0xBC, 0xFE, 0x81, 0x01, 0x78,
|
||||
0xF8, 0x1F, 0xFE, 0x0F, 0x1F, 0x0E, 0x00, 0x3E, 0x7C, 0xF0, 0x81, 0x01,
|
||||
0x78, 0xF8, 0x1F, 0xFE, 0x1F, 0x3F, 0x0E, 0x00, 0x3C, 0x3C, 0xE0, 0x83,
|
||||
0x01, 0x78, 0xF8, 0x1F, 0xFE, 0x0F, 0x1F, 0x0C, 0x00, 0x3E, 0x3C, 0xC0,
|
||||
0x03, 0x01, 0x7C, 0xF8, 0x1F, 0xF0, 0x0F, 0x1F, 0x0E, 0x00, 0x1F, 0x3C,
|
||||
0xC0, 0x83, 0x01, 0x78, 0x00, 0x3E, 0xC0, 0x0F, 0x1F, 0x1E, 0xF0, 0x0F,
|
||||
0x7C, 0xC0, 0x87, 0x01, 0x7C, 0x00, 0x7E, 0x80, 0x1F, 0x0A, 0x0F, 0xF8,
|
||||
0x0F, 0x7C, 0xC0, 0x07, 0x01, 0x78, 0x98, 0xFF, 0x01, 0x0F, 0x00, 0x0F,
|
||||
0xF0, 0x1F, 0x3C, 0x80, 0x83, 0x01, 0x78, 0xF8, 0xFF, 0x07, 0x0E, 0xC0,
|
||||
0x0F, 0x80, 0x3E, 0x3C, 0xC0, 0x87, 0x01, 0x78, 0xF8, 0xFF, 0x0F, 0x0E,
|
||||
0xFA, 0x1F, 0x00, 0x7E, 0x3C, 0xC0, 0x03, 0x01, 0x78, 0xF8, 0xFF, 0x1F,
|
||||
0x0E, 0xFF, 0x0F, 0x00, 0x7C, 0x3C, 0xC0, 0x83, 0x01, 0x7C, 0xF8, 0xFF,
|
||||
0x1F, 0x0E, 0xFF, 0x1F, 0x00, 0x7C, 0x7C, 0xE0, 0x83, 0x01, 0x78, 0xF8,
|
||||
0xDF, 0x0F, 0x0F, 0xFF, 0x0F, 0x00, 0x7C, 0x3C, 0xF0, 0x03, 0x01, 0x78,
|
||||
0x10, 0x0D, 0x04, 0x0F, 0xFF, 0x0F, 0x5C, 0x3F, 0xFC, 0xFF, 0x80, 0x01,
|
||||
0x78, 0x00, 0x0C, 0x00, 0x0F, 0xFF, 0x0F, 0xFC, 0x3F, 0xFC, 0xFF, 0x80,
|
||||
0x01, 0x78, 0x00, 0x1C, 0xC0, 0x0F, 0xFF, 0x0F, 0xFC, 0x0F, 0xFC, 0x3F,
|
||||
0x80, 0x00, 0xF8, 0xEB, 0xFF, 0xF9, 0xFF, 0xFF, 0x07, 0xF8, 0x07, 0xB8,
|
||||
0x07, 0x80, 0x00, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x07, 0x00, 0x00,
|
||||
0x00, 0x00, 0xC0, 0x00, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x07, 0x00,
|
||||
0x00, 0x00, 0x00, 0xC0, 0x00, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x03,
|
||||
0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0xE0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0x01, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0xC0, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0x01, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0xC0, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0xFE,
|
||||
0xFF, 0xFF, 0xFF, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00,
|
||||
0xFC, 0xFF, 0xFF, 0xFF, 0x07, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x03, 0x00,
|
||||
0x00, 0xF0, 0xFF, 0xFF, 0xFF, 0xA3, 0xD7, 0x7A, 0xAD, 0xE7, 0x79, 0x00,
|
||||
0x00, 0x00, 0x40, 0xFE, 0xFB, 0xBF, 0xFF, 0x7D, 0xDF, 0xF7, 0x7D, 0x1F,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x24, 0x49, 0x92, 0x24,
|
||||
0x91, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xE0, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0xC0, 0xFF, 0xFF, 0xFF, 0xFF, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0xFC, 0xFF, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0x1F, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF4, 0xFF, 0x02, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
const uint8_t ESP3D_Logo[] PROGMEM = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA0,
|
||||
0x4B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xFE, 0xFF, 0x0B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xE0, 0xFF, 0xFF, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0xF8, 0xFF, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xFE, 0xFF, 0xFF, 0xFF, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0xC0, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xAE, 0xDD, 0xDD, 0xF7,
|
||||
0x79, 0xBB, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x04,
|
||||
0x48, 0x48, 0x10, 0x81, 0x44, 0x10, 0x08, 0x00, 0x00, 0x00, 0xD0, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x9F, 0x00, 0x00, 0x00, 0xF8,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x21, 0x22, 0xF8, 0x01, 0x00, 0x00,
|
||||
0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x00, 0x00, 0x80, 0x03, 0x00,
|
||||
0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00, 0x0E,
|
||||
0x00, 0x80, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00,
|
||||
0x1C, 0x00, 0xC0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00,
|
||||
0x00, 0x30, 0x00, 0xE0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x00, 0x00,
|
||||
0x00, 0x00, 0x20, 0x00, 0xE0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x3F, 0x00,
|
||||
0x00, 0x00, 0x00, 0x60, 0x00, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x3F,
|
||||
0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0xF0, 0xFF, 0xFF, 0xFB, 0xFF, 0xFF,
|
||||
0x1F, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x78, 0x00, 0x7C, 0x80, 0x0F,
|
||||
0xC0, 0x1F, 0xF0, 0x07, 0xE8, 0x0F, 0x80, 0x00, 0x78, 0x00, 0x3C, 0x80,
|
||||
0x0F, 0x00, 0x0F, 0xF8, 0x1F, 0xFC, 0x3F, 0x80, 0x01, 0x78, 0x00, 0x1C,
|
||||
0x08, 0x0F, 0x00, 0x1F, 0xFC, 0x1F, 0xFC, 0xFF, 0x80, 0x00, 0x78, 0xF8,
|
||||
0x1F, 0x7E, 0x0F, 0x1F, 0x0E, 0x1C, 0x3E, 0xBC, 0xFE, 0x81, 0x01, 0x78,
|
||||
0xF8, 0x1F, 0xFE, 0x0F, 0x1F, 0x0E, 0x00, 0x3E, 0x7C, 0xF0, 0x81, 0x01,
|
||||
0x78, 0xF8, 0x1F, 0xFE, 0x1F, 0x3F, 0x0E, 0x00, 0x3C, 0x3C, 0xE0, 0x83,
|
||||
0x01, 0x78, 0xF8, 0x1F, 0xFE, 0x0F, 0x1F, 0x0C, 0x00, 0x3E, 0x3C, 0xC0,
|
||||
0x03, 0x01, 0x7C, 0xF8, 0x1F, 0xF0, 0x0F, 0x1F, 0x0E, 0x00, 0x1F, 0x3C,
|
||||
0xC0, 0x83, 0x01, 0x78, 0x00, 0x3E, 0xC0, 0x0F, 0x1F, 0x1E, 0xF0, 0x0F,
|
||||
0x7C, 0xC0, 0x87, 0x01, 0x7C, 0x00, 0x7E, 0x80, 0x1F, 0x0A, 0x0F, 0xF8,
|
||||
0x0F, 0x7C, 0xC0, 0x07, 0x01, 0x78, 0x98, 0xFF, 0x01, 0x0F, 0x00, 0x0F,
|
||||
0xF0, 0x1F, 0x3C, 0x80, 0x83, 0x01, 0x78, 0xF8, 0xFF, 0x07, 0x0E, 0xC0,
|
||||
0x0F, 0x80, 0x3E, 0x3C, 0xC0, 0x87, 0x01, 0x78, 0xF8, 0xFF, 0x0F, 0x0E,
|
||||
0xFA, 0x1F, 0x00, 0x7E, 0x3C, 0xC0, 0x03, 0x01, 0x78, 0xF8, 0xFF, 0x1F,
|
||||
0x0E, 0xFF, 0x0F, 0x00, 0x7C, 0x3C, 0xC0, 0x83, 0x01, 0x7C, 0xF8, 0xFF,
|
||||
0x1F, 0x0E, 0xFF, 0x1F, 0x00, 0x7C, 0x7C, 0xE0, 0x83, 0x01, 0x78, 0xF8,
|
||||
0xDF, 0x0F, 0x0F, 0xFF, 0x0F, 0x00, 0x7C, 0x3C, 0xF0, 0x03, 0x01, 0x78,
|
||||
0x10, 0x0D, 0x04, 0x0F, 0xFF, 0x0F, 0x5C, 0x3F, 0xFC, 0xFF, 0x80, 0x01,
|
||||
0x78, 0x00, 0x0C, 0x00, 0x0F, 0xFF, 0x0F, 0xFC, 0x3F, 0xFC, 0xFF, 0x80,
|
||||
0x01, 0x78, 0x00, 0x1C, 0xC0, 0x0F, 0xFF, 0x0F, 0xFC, 0x0F, 0xFC, 0x3F,
|
||||
0x80, 0x00, 0xF8, 0xEB, 0xFF, 0xF9, 0xFF, 0xFF, 0x07, 0xF8, 0x07, 0xB8,
|
||||
0x07, 0x80, 0x00, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x07, 0x00, 0x00,
|
||||
0x00, 0x00, 0xC0, 0x00, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x07, 0x00,
|
||||
0x00, 0x00, 0x00, 0xC0, 0x00, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x03,
|
||||
0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0xE0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0x01, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0xC0, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0x01, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0xC0, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0xFE,
|
||||
0xFF, 0xFF, 0xFF, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00,
|
||||
0xFC, 0xFF, 0xFF, 0xFF, 0x07, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x03, 0x00,
|
||||
0x00, 0xF0, 0xFF, 0xFF, 0xFF, 0xA3, 0xD7, 0x7A, 0xAD, 0xE7, 0x79, 0x00,
|
||||
0x00, 0x00, 0x40, 0xFE, 0xFB, 0xBF, 0xFF, 0x7D, 0xDF, 0xF7, 0x7D, 0x1F,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x24, 0x49, 0x92, 0x24,
|
||||
0x91, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xE0, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0xC0, 0xFF, 0xFF, 0xFF, 0xFF, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0xFC, 0xFF, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0x1F, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF4, 0xFF, 0x02, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
|
||||
#endif //_esp3d_logo_h
|
||||
#endif //_esp3d_logo_h
|
||||
|
@ -18,35 +18,35 @@
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
//Screen size
|
||||
#define SCREEN_WIDTH 240
|
||||
#define SCREEN_HEIGHT 240
|
||||
// Screen size
|
||||
#define SCREEN_WIDTH 240
|
||||
#define SCREEN_HEIGHT 240
|
||||
|
||||
//Colors
|
||||
#define COLOR_BLACK TFT_BLACK
|
||||
#define COLOR_WHITE TFT_WHITE
|
||||
#define SPLASH_FG COLOR_WHITE
|
||||
#define SPLASH_BG COLOR_BLACK
|
||||
#define SCREEN_BG COLOR_BLACK
|
||||
// Colors
|
||||
#define COLOR_BLACK TFT_BLACK
|
||||
#define COLOR_WHITE TFT_WHITE
|
||||
#define SPLASH_FG COLOR_WHITE
|
||||
#define SPLASH_BG COLOR_BLACK
|
||||
#define SCREEN_BG COLOR_BLACK
|
||||
#define PROGRESS_FG TFT_BLUE
|
||||
#define SIGNAL_FG TFT_CYAN
|
||||
#define SIGNAL_FG TFT_CYAN
|
||||
#define SSID_FG TFT_ORANGE
|
||||
#define IP_FG COLOR_WHITE
|
||||
#define STATUS_FG TFT_YELLOW
|
||||
#define IP_FG COLOR_WHITE
|
||||
#define STATUS_FG TFT_YELLOW
|
||||
|
||||
//Fonts
|
||||
#define FONTSIGNAL 2
|
||||
#define FONTSSID 2
|
||||
#define FONTIP 4
|
||||
#define FONTSTATUS 2
|
||||
// Fonts
|
||||
#define FONTSIGNAL 2
|
||||
#define FONTSSID 2
|
||||
#define FONTIP 4
|
||||
#define FONTSTATUS 2
|
||||
|
||||
//Positions
|
||||
#define SIGNAL_X SCREEN_WIDTH-34
|
||||
// Positions
|
||||
#define SIGNAL_X SCREEN_WIDTH - 34
|
||||
#define SIGNAL_Y 0
|
||||
#define SIGNAL_W 46
|
||||
#define SIGNAL_H 14
|
||||
|
||||
#define SIGNAL_ICON_X SCREEN_WIDTH-60
|
||||
#define SIGNAL_ICON_X SCREEN_WIDTH - 60
|
||||
#define SIGNAL_ICON_Y 2
|
||||
#define SIGNAL_ICON_W 23
|
||||
#define SIGNAL_ICON_H 10
|
||||
@ -59,11 +59,11 @@
|
||||
#define SSID_AREA_H 14
|
||||
|
||||
#define IP_AREA_X 0
|
||||
#define IP_AREA_Y (SCREEN_HEIGHT/2) - 8
|
||||
#define IP_AREA_Y (SCREEN_HEIGHT / 2) - 8
|
||||
#define IP_AREA_W SCREEN_WIDTH
|
||||
#define IP_AREA_H 20
|
||||
|
||||
#define STATUS_AREA_X 0
|
||||
#define STATUS_AREA_Y SCREEN_HEIGHT-16
|
||||
#define STATUS_AREA_Y SCREEN_HEIGHT - 16
|
||||
#define STATUS_AREA_W SCREEN_WIDTH
|
||||
#define STATUS_AREA_H 16
|
||||
|
@ -18,54 +18,49 @@
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef _ETH_CONFIG_H
|
||||
#define _ETH_CONFIG_H
|
||||
#include <Arduino.h>
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
#include "../../include/esp3d_config.h"
|
||||
#if defined (ESP3D_ETH_CLK_MODE)
|
||||
#define ETH_CLK_MODE (eth_clock_mode_t)ESP3D_ETH_CLK_MODE
|
||||
#endif //ESP3D_ETH_CLK_MODE
|
||||
#if defined (ESP3D_ETH_PHY_POWER_PIN)
|
||||
#if defined(ESP3D_ETH_CLK_MODE)
|
||||
#define ETH_CLK_MODE (eth_clock_mode_t) ESP3D_ETH_CLK_MODE
|
||||
#endif // ESP3D_ETH_CLK_MODE
|
||||
#if defined(ESP3D_ETH_PHY_POWER_PIN)
|
||||
#define ETH_PHY_POWER ESP3D_ETH_PHY_POWER_PIN
|
||||
#endif //ESP3D_ETH_PHY_POWER
|
||||
#endif // ESP3D_ETH_PHY_POWER
|
||||
#if defined(ESP3D_ETH_PHY_TYPE)
|
||||
#define ETH_PHY_TYPE (eth_phy_type_t)ESP3D_ETH_PHY_TYPE
|
||||
#endif //ESP3D_ETH_PHY_TYPE
|
||||
#if defined (ESP3D_ETH_PHY_MDC_PIN)
|
||||
#define ETH_PHY_TYPE (eth_phy_type_t) ESP3D_ETH_PHY_TYPE
|
||||
#endif // ESP3D_ETH_PHY_TYPE
|
||||
#if defined(ESP3D_ETH_PHY_MDC_PIN)
|
||||
#define ETH_PHY_MDC ESP3D_ETH_PHY_MDC_PIN
|
||||
#endif //ESP3D_ETH_PHY_MDC_PIN
|
||||
#if defined (ESP3D_ETH_PHY_MDIO_PIN)
|
||||
#endif // ESP3D_ETH_PHY_MDC_PIN
|
||||
#if defined(ESP3D_ETH_PHY_MDIO_PIN)
|
||||
#define ETH_PHY_MDIO ESP3D_ETH_PHY_MDIO_PIN
|
||||
#endif //ESP3D_ETH_PHY_MDIO_PIN
|
||||
#endif // ESP3D_ETH_PHY_MDIO_PIN
|
||||
#if defined(ESP3D_ETH_PHY_ADDR)
|
||||
#define ETH_PHY_ADDR ESP3D_ETH_PHY_ADDR
|
||||
#endif //ESP3D_ETH_PHY_ADDR
|
||||
#endif // ESP3D_ETH_PHY_ADDR
|
||||
#include "ETH.h"
|
||||
#endif //ARDUINO_ARCH_ESP32
|
||||
#endif // ARDUINO_ARCH_ESP32
|
||||
#ifdef ARDUINO_ARCH_ESP8266
|
||||
#endif //ARDUINO_ARCH_ESP8266
|
||||
#endif // ARDUINO_ARCH_ESP8266
|
||||
|
||||
class EthConfig
|
||||
{
|
||||
public:
|
||||
static bool begin(int8_t & espMode);
|
||||
static bool StartSTA();
|
||||
//static bool StartSRV();
|
||||
static void end();
|
||||
static void handle();
|
||||
static bool started();
|
||||
static void setConnected(bool connected)
|
||||
{
|
||||
_connected = connected;
|
||||
}
|
||||
class EthConfig {
|
||||
public:
|
||||
static bool begin(int8_t& espMode);
|
||||
static bool StartSTA();
|
||||
// static bool StartSRV();
|
||||
static void end();
|
||||
static void handle();
|
||||
static bool started();
|
||||
static void setConnected(bool connected) { _connected = connected; }
|
||||
|
||||
static bool linkUp();
|
||||
private :
|
||||
static bool _started;
|
||||
static bool _connected;
|
||||
static bool linkUp();
|
||||
|
||||
private:
|
||||
static bool _started;
|
||||
static bool _connected;
|
||||
};
|
||||
|
||||
#endif //_ETH_CONFIG_H
|
||||
#endif //_ETH_CONFIG_H
|
||||
|
@ -24,7 +24,6 @@
|
||||
|
||||
#include "../../include/esp3d_config.h"
|
||||
|
||||
|
||||
#define ESP_FLASH_FS_HEADER "/FS"
|
||||
|
||||
#define ESP_MAX_OPENHANDLE 4
|
||||
|
@ -27,7 +27,6 @@ littlefs_esp8266_filesystem.cpp - ESP3D littlefs filesystem configuration class
|
||||
|
||||
#include "../esp_filesystem.h"
|
||||
|
||||
|
||||
Dir tDir_handle[ESP_MAX_OPENHANDLE];
|
||||
extern File tFile_handle[ESP_MAX_OPENHANDLE];
|
||||
|
||||
|
@ -230,7 +230,7 @@ bool ESP_SD::rename(const char* oldpath, const char* newpath) {
|
||||
return SD.rename(oldpath, newpath);
|
||||
}
|
||||
|
||||
bool ESP_SD::format() {
|
||||
bool ESP_SD::format() {
|
||||
uint32_t const ERASE_SIZE = 262144L;
|
||||
uint32_t cardSectorCount = 0;
|
||||
uint8_t sectorBuffer[512];
|
||||
@ -290,7 +290,7 @@ bool ESP_SD::format() {
|
||||
: fatFormatter.format(m_card, sectorBuffer, nullptr);
|
||||
|
||||
if (!rtn) {
|
||||
esp3d_log_e("erase failed");
|
||||
esp3d_log_e("erase failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -303,35 +303,35 @@ ESP_SDFile ESP_SD::open(const char* path, uint8_t mode) {
|
||||
if (((strcmp(path, "/") == 0) &&
|
||||
((mode == ESP_FILE_WRITE) || (mode == ESP_FILE_APPEND))) ||
|
||||
(strlen(path) == 0)) {
|
||||
_sizechanged = true;
|
||||
esp3d_log_e("reject %s", path);
|
||||
return ESP_SDFile();
|
||||
_sizechanged = true;
|
||||
esp3d_log_e("reject %s", path);
|
||||
return ESP_SDFile();
|
||||
}
|
||||
// path must start by '/'
|
||||
if (path[0] != '/') {
|
||||
esp3d_log_e("%s is invalid path", path);
|
||||
return ESP_SDFile();
|
||||
esp3d_log_e("%s is invalid path", path);
|
||||
return ESP_SDFile();
|
||||
}
|
||||
if (mode != ESP_FILE_READ) {
|
||||
// check container exists
|
||||
String p = path;
|
||||
p.remove(p.lastIndexOf('/') + 1);
|
||||
if (!exists(p.c_str())) {
|
||||
esp3d_log_e("Error opening: %s", path);
|
||||
return ESP_SDFile();
|
||||
}
|
||||
// check container exists
|
||||
String p = path;
|
||||
p.remove(p.lastIndexOf('/') + 1);
|
||||
if (!exists(p.c_str())) {
|
||||
esp3d_log_e("Error opening: %s", path);
|
||||
return ESP_SDFile();
|
||||
}
|
||||
}
|
||||
File tmp = SD.open(path, (mode == ESP_FILE_READ) ? FILE_READ
|
||||
: (mode == ESP_FILE_WRITE) ? FILE_WRITE
|
||||
: FILE_WRITE);
|
||||
if (tmp) {
|
||||
ESP_SDFile esptmp(&tmp, strcmp(path, "/") == 0 ? true : tmp.isDir(),
|
||||
(mode == ESP_FILE_READ) ? false : true, path);
|
||||
esp3d_log("%s is a %s", path, tmp.isDir() ? "Dir" : "File");
|
||||
return esptmp;
|
||||
ESP_SDFile esptmp(&tmp, strcmp(path, "/") == 0 ? true : tmp.isDir(),
|
||||
(mode == ESP_FILE_READ) ? false : true, path);
|
||||
esp3d_log("%s is a %s", path, tmp.isDir() ? "Dir" : "File");
|
||||
return esptmp;
|
||||
} else {
|
||||
esp3d_log_e("open %s failed", path);
|
||||
return ESP_SDFile();
|
||||
esp3d_log_e("open %s failed", path);
|
||||
return ESP_SDFile();
|
||||
}
|
||||
}
|
||||
|
||||
@ -339,14 +339,14 @@ bool ESP_SD::exists(const char* path) {
|
||||
bool res = false;
|
||||
// root should always be there if started
|
||||
if (strcmp(path, "/") == 0) {
|
||||
return _started;
|
||||
return _started;
|
||||
}
|
||||
res = SD.exists(path);
|
||||
if (!res) {
|
||||
ESP_SDFile root = ESP_SD::open(path, ESP_FILE_READ);
|
||||
if (root) {
|
||||
res = root.isDirectory();
|
||||
}
|
||||
ESP_SDFile root = ESP_SD::open(path, ESP_FILE_READ);
|
||||
if (root) {
|
||||
res = root.isDirectory();
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
@ -361,52 +361,52 @@ bool ESP_SD::mkdir(const char* path) { return SD.mkdir(path); }
|
||||
bool ESP_SD::rmdir(const char* path) {
|
||||
String p = path;
|
||||
if (!p.endsWith("/")) {
|
||||
p += '/';
|
||||
p += '/';
|
||||
}
|
||||
if (!p.startsWith("/")) {
|
||||
p = '/' + p;
|
||||
p = '/' + p;
|
||||
}
|
||||
if (!exists(p.c_str())) {
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
bool res = true;
|
||||
std::stack<String> pathlist;
|
||||
pathlist.push(p);
|
||||
while (pathlist.size() > 0 && res) {
|
||||
File dir = SD.open(pathlist.top().c_str());
|
||||
dir.rewindDirectory();
|
||||
File f = dir.openNextFile();
|
||||
bool candelete = true;
|
||||
while (f && res) {
|
||||
if (f.isDir()) {
|
||||
candelete = false;
|
||||
String newdir;
|
||||
char tmp[255];
|
||||
f.getName(tmp, 254);
|
||||
newdir = pathlist.top() + tmp;
|
||||
newdir += "/";
|
||||
pathlist.push(newdir);
|
||||
f.close();
|
||||
f = File();
|
||||
} else {
|
||||
char tmp[255];
|
||||
f.getName(tmp, 254);
|
||||
_sizechanged = true;
|
||||
String filepath = pathlist.top() + tmp;
|
||||
f.close();
|
||||
if (!SD.remove(filepath.c_str())) {
|
||||
res = false;
|
||||
}
|
||||
f = dir.openNextFile();
|
||||
}
|
||||
}
|
||||
if (candelete) {
|
||||
if (pathlist.top() != "/") {
|
||||
res = SD.rmdir(pathlist.top().c_str());
|
||||
}
|
||||
pathlist.pop();
|
||||
}
|
||||
dir.close();
|
||||
File dir = SD.open(pathlist.top().c_str());
|
||||
dir.rewindDirectory();
|
||||
File f = dir.openNextFile();
|
||||
bool candelete = true;
|
||||
while (f && res) {
|
||||
if (f.isDir()) {
|
||||
candelete = false;
|
||||
String newdir;
|
||||
char tmp[255];
|
||||
f.getName(tmp, 254);
|
||||
newdir = pathlist.top() + tmp;
|
||||
newdir += "/";
|
||||
pathlist.push(newdir);
|
||||
f.close();
|
||||
f = File();
|
||||
} else {
|
||||
char tmp[255];
|
||||
f.getName(tmp, 254);
|
||||
_sizechanged = true;
|
||||
String filepath = pathlist.top() + tmp;
|
||||
f.close();
|
||||
if (!SD.remove(filepath.c_str())) {
|
||||
res = false;
|
||||
}
|
||||
f = dir.openNextFile();
|
||||
}
|
||||
}
|
||||
if (candelete) {
|
||||
if (pathlist.top() != "/") {
|
||||
res = SD.rmdir(pathlist.top().c_str());
|
||||
}
|
||||
pathlist.pop();
|
||||
}
|
||||
dir.close();
|
||||
}
|
||||
p = String();
|
||||
esp3d_log("count %d has error %d\n", pathlist.size(), res);
|
||||
@ -415,14 +415,14 @@ bool ESP_SD::rmdir(const char* path) {
|
||||
|
||||
void ESP_SD::closeAll() {
|
||||
for (uint8_t i = 0; i < ESP_MAX_SD_OPENHANDLE; i++) {
|
||||
tSDFile_handle[i].close();
|
||||
tSDFile_handle[i] = File();
|
||||
tSDFile_handle[i].close();
|
||||
tSDFile_handle[i] = File();
|
||||
}
|
||||
}
|
||||
|
||||
bool ESP_SDFile::seek(uint32_t pos, uint8_t mode) {
|
||||
if (mode == ESP_SEEK_END) {
|
||||
return tSDFile_handle[_index].seek(-pos); // based on SDFS comment
|
||||
return tSDFile_handle[_index].seek(-pos); // based on SDFS comment
|
||||
}
|
||||
return tSDFile_handle[_index].seek(pos);
|
||||
}
|
||||
@ -438,46 +438,46 @@ ESP_SDFile::ESP_SDFile(void* handle, bool isdir, bool iswritemode,
|
||||
_iswritemode = iswritemode;
|
||||
_size = 0;
|
||||
if (!handle) {
|
||||
return;
|
||||
return;
|
||||
}
|
||||
bool set = false;
|
||||
for (uint8_t i = 0; (i < ESP_MAX_SD_OPENHANDLE) && !set; i++) {
|
||||
if (!tSDFile_handle[i]) {
|
||||
tSDFile_handle[i] = *((File*)handle);
|
||||
// filename
|
||||
char tmp[255];
|
||||
tSDFile_handle[i].getName(tmp, 254);
|
||||
_filename = path;
|
||||
// name
|
||||
_name = tmp;
|
||||
if (_name.endsWith("/")) {
|
||||
_name.remove(_name.length() - 1, 1);
|
||||
_isdir = true;
|
||||
}
|
||||
if (_name[0] == '/') {
|
||||
_name.remove(0, 1);
|
||||
}
|
||||
int pos = _name.lastIndexOf('/');
|
||||
if (pos != -1) {
|
||||
_name.remove(0, pos + 1);
|
||||
}
|
||||
if (_name.length() == 0) {
|
||||
_name = "/";
|
||||
}
|
||||
// size
|
||||
_size = tSDFile_handle[i].size();
|
||||
// time
|
||||
if (!_isdir && !iswritemode) {
|
||||
_lastwrite = getDateTimeFile(tSDFile_handle[i]);
|
||||
if (!tSDFile_handle[i]) {
|
||||
tSDFile_handle[i] = *((File*)handle);
|
||||
// filename
|
||||
char tmp[255];
|
||||
tSDFile_handle[i].getName(tmp, 254);
|
||||
_filename = path;
|
||||
// name
|
||||
_name = tmp;
|
||||
if (_name.endsWith("/")) {
|
||||
_name.remove(_name.length() - 1, 1);
|
||||
_isdir = true;
|
||||
}
|
||||
if (_name[0] == '/') {
|
||||
_name.remove(0, 1);
|
||||
}
|
||||
int pos = _name.lastIndexOf('/');
|
||||
if (pos != -1) {
|
||||
_name.remove(0, pos + 1);
|
||||
}
|
||||
if (_name.length() == 0) {
|
||||
_name = "/";
|
||||
}
|
||||
// size
|
||||
_size = tSDFile_handle[i].size();
|
||||
// time
|
||||
if (!_isdir && !iswritemode) {
|
||||
_lastwrite = getDateTimeFile(tSDFile_handle[i]);
|
||||
|
||||
} else {
|
||||
// no need date time for directory
|
||||
_lastwrite = 0;
|
||||
}
|
||||
_index = i;
|
||||
// esp3d_log("Opening File at index %d",_index);
|
||||
set = true;
|
||||
}
|
||||
} else {
|
||||
// no need date time for directory
|
||||
_lastwrite = 0;
|
||||
}
|
||||
_index = i;
|
||||
// esp3d_log("Opening File at index %d",_index);
|
||||
set = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
// todo need also to add short filename
|
||||
@ -488,56 +488,56 @@ const char* ESP_SDFile::shortname() const {
|
||||
static char sname[13];
|
||||
File ftmp = SD.open(_filename.c_str());
|
||||
if (ftmp) {
|
||||
ftmp.getSFN(sname, 12);
|
||||
ftmp.close();
|
||||
if (strlen(sname) == 0) {
|
||||
return _name.c_str();
|
||||
}
|
||||
return sname;
|
||||
ftmp.getSFN(sname, 12);
|
||||
ftmp.close();
|
||||
if (strlen(sname) == 0) {
|
||||
return _name.c_str();
|
||||
}
|
||||
return sname;
|
||||
} else {
|
||||
return _name.c_str();
|
||||
return _name.c_str();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void ESP_SDFile::close() {
|
||||
if (_index != -1) {
|
||||
// esp3d_log("Closing File at index %d", _index);
|
||||
tSDFile_handle[_index].close();
|
||||
// reopen if mode = write
|
||||
// udate size + date
|
||||
if (_iswritemode && !_isdir) {
|
||||
File ftmp = SD.open(_filename.c_str());
|
||||
if (ftmp) {
|
||||
_size = ftmp.size();
|
||||
_lastwrite = getDateTimeFile(ftmp);
|
||||
ftmp.close();
|
||||
}
|
||||
}
|
||||
tSDFile_handle[_index] = File();
|
||||
// esp3d_log("Closing File at index %d",_index);
|
||||
_index = -1;
|
||||
// esp3d_log("Closing File at index %d", _index);
|
||||
tSDFile_handle[_index].close();
|
||||
// reopen if mode = write
|
||||
// udate size + date
|
||||
if (_iswritemode && !_isdir) {
|
||||
File ftmp = SD.open(_filename.c_str());
|
||||
if (ftmp) {
|
||||
_size = ftmp.size();
|
||||
_lastwrite = getDateTimeFile(ftmp);
|
||||
ftmp.close();
|
||||
}
|
||||
}
|
||||
tSDFile_handle[_index] = File();
|
||||
// esp3d_log("Closing File at index %d",_index);
|
||||
_index = -1;
|
||||
}
|
||||
}
|
||||
|
||||
ESP_SDFile ESP_SDFile::openNextFile() {
|
||||
if ((_index == -1) || !_isdir) {
|
||||
esp3d_log("openNextFile failed");
|
||||
return ESP_SDFile();
|
||||
esp3d_log("openNextFile failed");
|
||||
return ESP_SDFile();
|
||||
}
|
||||
File tmp = tSDFile_handle[_index].openNextFile();
|
||||
if (tmp) {
|
||||
char tmps[255];
|
||||
tmp.getName(tmps, 254);
|
||||
esp3d_log("tmp name :%s %s", tmps, (tmp.isDir()) ? "isDir" : "isFile");
|
||||
String s = _filename;
|
||||
if (s != "/") {
|
||||
s += "/";
|
||||
}
|
||||
s += tmps;
|
||||
ESP_SDFile esptmp(&tmp, tmp.isDir(), false, s.c_str());
|
||||
esptmp.close();
|
||||
return esptmp;
|
||||
char tmps[255];
|
||||
tmp.getName(tmps, 254);
|
||||
esp3d_log("tmp name :%s %s", tmps, (tmp.isDir()) ? "isDir" : "isFile");
|
||||
String s = _filename;
|
||||
if (s != "/") {
|
||||
s += "/";
|
||||
}
|
||||
s += tmps;
|
||||
ESP_SDFile esptmp(&tmp, tmp.isDir(), false, s.c_str());
|
||||
esptmp.close();
|
||||
return esptmp;
|
||||
}
|
||||
return ESP_SDFile();
|
||||
}
|
||||
|
@ -269,92 +269,92 @@ bool ESP_SD::format() {
|
||||
|
||||
if (!rtn) {
|
||||
esp3d_log_e("erase failed");
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
esp3d_log_e("cannot erase");
|
||||
|
||||
esp3d_log_e("cannot erase");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
ESP_SDFile ESP_SD::open(const char* path, uint8_t mode) {
|
||||
// do some check
|
||||
if (((strcmp(path, "/") == 0) &&
|
||||
((mode == ESP_FILE_WRITE) || (mode == ESP_FILE_APPEND))) ||
|
||||
(strlen(path) == 0)) {
|
||||
_sizechanged = true;
|
||||
return ESP_SDFile();
|
||||
}
|
||||
// path must start by '/'
|
||||
if (path[0] != '/') {
|
||||
return ESP_SDFile();
|
||||
}
|
||||
if (mode != ESP_FILE_READ) {
|
||||
// check container exists
|
||||
String p = path;
|
||||
p.remove(p.lastIndexOf('/') + 1);
|
||||
if (!exists(p.c_str())) {
|
||||
// do some check
|
||||
if (((strcmp(path, "/") == 0) &&
|
||||
((mode == ESP_FILE_WRITE) || (mode == ESP_FILE_APPEND))) ||
|
||||
(strlen(path) == 0)) {
|
||||
_sizechanged = true;
|
||||
return ESP_SDFile();
|
||||
}
|
||||
// path must start by '/'
|
||||
if (path[0] != '/') {
|
||||
return ESP_SDFile();
|
||||
}
|
||||
if (mode != ESP_FILE_READ) {
|
||||
// check container exists
|
||||
String p = path;
|
||||
p.remove(p.lastIndexOf('/') + 1);
|
||||
if (!exists(p.c_str())) {
|
||||
esp3d_log("Error opening: %s", path);
|
||||
return ESP_SDFile();
|
||||
}
|
||||
}
|
||||
File tmp = SD.open(path, (mode == ESP_FILE_READ) ? FILE_READ
|
||||
: (mode == ESP_FILE_WRITE) ? FILE_WRITE
|
||||
: FILE_WRITE);
|
||||
ESP_SDFile esptmp(&tmp, tmp.isDir(), (mode == ESP_FILE_READ) ? false : true,
|
||||
path);
|
||||
return esptmp;
|
||||
}
|
||||
}
|
||||
File tmp = SD.open(path, (mode == ESP_FILE_READ) ? FILE_READ
|
||||
: (mode == ESP_FILE_WRITE) ? FILE_WRITE
|
||||
: FILE_WRITE);
|
||||
ESP_SDFile esptmp(&tmp, tmp.isDir(), (mode == ESP_FILE_READ) ? false : true,
|
||||
path);
|
||||
return esptmp;
|
||||
}
|
||||
|
||||
bool ESP_SD::exists(const char* path) {
|
||||
bool res = false;
|
||||
// root should always be there if started
|
||||
if (strcmp(path, "/") == 0) {
|
||||
return _started;
|
||||
}
|
||||
esp3d_log("%s exists ?", path);
|
||||
res = SD.exists(path);
|
||||
if (!res) {
|
||||
esp3d_log("Seems not - trying open it");
|
||||
ESP_SDFile root = ESP_SD::open(path, ESP_FILE_READ);
|
||||
if (root) {
|
||||
bool res = false;
|
||||
// root should always be there if started
|
||||
if (strcmp(path, "/") == 0) {
|
||||
return _started;
|
||||
}
|
||||
esp3d_log("%s exists ?", path);
|
||||
res = SD.exists(path);
|
||||
if (!res) {
|
||||
esp3d_log("Seems not - trying open it");
|
||||
ESP_SDFile root = ESP_SD::open(path, ESP_FILE_READ);
|
||||
if (root) {
|
||||
res = root.isDirectory();
|
||||
}
|
||||
}
|
||||
esp3d_log("Seems %s", res ? "yes" : "no");
|
||||
return res;
|
||||
}
|
||||
}
|
||||
esp3d_log("Seems %s", res ? "yes" : "no");
|
||||
return res;
|
||||
}
|
||||
|
||||
bool ESP_SD::remove(const char* path) {
|
||||
_sizechanged = true;
|
||||
return SD.remove(path);
|
||||
_sizechanged = true;
|
||||
return SD.remove(path);
|
||||
}
|
||||
|
||||
bool ESP_SD::mkdir(const char* path) { return SD.mkdir(path); }
|
||||
|
||||
bool ESP_SD::rmdir(const char* path) {
|
||||
String p = path;
|
||||
if (!p.endsWith("/")) {
|
||||
p += '/';
|
||||
}
|
||||
if (!p.startsWith("/")) {
|
||||
p = '/' + p;
|
||||
}
|
||||
if (!exists(p.c_str())) {
|
||||
return false;
|
||||
}
|
||||
bool res = true;
|
||||
std::stack<String> pathlist;
|
||||
pathlist.push(p);
|
||||
while (pathlist.size() > 0 && res) {
|
||||
File dir = SD.open(pathlist.top().c_str());
|
||||
dir.rewindDirectory();
|
||||
File f = dir.openNextFile();
|
||||
bool candelete = true;
|
||||
while (f && res) {
|
||||
String p = path;
|
||||
if (!p.endsWith("/")) {
|
||||
p += '/';
|
||||
}
|
||||
if (!p.startsWith("/")) {
|
||||
p = '/' + p;
|
||||
}
|
||||
if (!exists(p.c_str())) {
|
||||
return false;
|
||||
}
|
||||
bool res = true;
|
||||
std::stack<String> pathlist;
|
||||
pathlist.push(p);
|
||||
while (pathlist.size() > 0 && res) {
|
||||
File dir = SD.open(pathlist.top().c_str());
|
||||
dir.rewindDirectory();
|
||||
File f = dir.openNextFile();
|
||||
bool candelete = true;
|
||||
while (f && res) {
|
||||
if (f.isDir()) {
|
||||
candelete = false;
|
||||
String newdir;
|
||||
@ -376,54 +376,54 @@ bool ESP_SD::rmdir(const char* path) {
|
||||
}
|
||||
f = dir.openNextFile();
|
||||
}
|
||||
}
|
||||
if (candelete) {
|
||||
}
|
||||
if (candelete) {
|
||||
if (pathlist.top() != "/") {
|
||||
res = SD.rmdir(pathlist.top().c_str());
|
||||
}
|
||||
pathlist.pop();
|
||||
}
|
||||
dir.close();
|
||||
}
|
||||
p = String();
|
||||
esp3d_log("count %d", pathlist.size());
|
||||
return res;
|
||||
}
|
||||
dir.close();
|
||||
}
|
||||
p = String();
|
||||
esp3d_log("count %d", pathlist.size());
|
||||
return res;
|
||||
}
|
||||
|
||||
bool ESP_SDFile::seek(uint32_t pos, uint8_t mode) {
|
||||
if (mode == SeekCur) {
|
||||
return tSDFile_handle[_index].seekCur(pos);
|
||||
}
|
||||
if (mode == SeekEnd) {
|
||||
return tSDFile_handle[_index].seekEnd(pos);
|
||||
}
|
||||
// if (mode == SeekSet)
|
||||
return tSDFile_handle[_index].seekSet(pos);
|
||||
if (mode == SeekCur) {
|
||||
return tSDFile_handle[_index].seekCur(pos);
|
||||
}
|
||||
if (mode == SeekEnd) {
|
||||
return tSDFile_handle[_index].seekEnd(pos);
|
||||
}
|
||||
// if (mode == SeekSet)
|
||||
return tSDFile_handle[_index].seekSet(pos);
|
||||
}
|
||||
|
||||
void ESP_SD::closeAll() {
|
||||
for (uint8_t i = 0; i < ESP_MAX_SD_OPENHANDLE; i++) {
|
||||
tSDFile_handle[i].close();
|
||||
tSDFile_handle[i] = File();
|
||||
}
|
||||
for (uint8_t i = 0; i < ESP_MAX_SD_OPENHANDLE; i++) {
|
||||
tSDFile_handle[i].close();
|
||||
tSDFile_handle[i] = File();
|
||||
}
|
||||
}
|
||||
|
||||
ESP_SDFile::ESP_SDFile(void* handle, bool isdir, bool iswritemode,
|
||||
const char* path) {
|
||||
_isdir = isdir;
|
||||
_dirlist = "";
|
||||
_index = -1;
|
||||
_filename = "";
|
||||
_name = "";
|
||||
_lastwrite = 0;
|
||||
_iswritemode = iswritemode;
|
||||
_size = 0;
|
||||
if (!handle) {
|
||||
return;
|
||||
}
|
||||
bool set = false;
|
||||
for (uint8_t i = 0; (i < ESP_MAX_SD_OPENHANDLE) && !set; i++) {
|
||||
if (!tSDFile_handle[i]) {
|
||||
_isdir = isdir;
|
||||
_dirlist = "";
|
||||
_index = -1;
|
||||
_filename = "";
|
||||
_name = "";
|
||||
_lastwrite = 0;
|
||||
_iswritemode = iswritemode;
|
||||
_size = 0;
|
||||
if (!handle) {
|
||||
return;
|
||||
}
|
||||
bool set = false;
|
||||
for (uint8_t i = 0; (i < ESP_MAX_SD_OPENHANDLE) && !set; i++) {
|
||||
if (!tSDFile_handle[i]) {
|
||||
tSDFile_handle[i] = *((File*)handle);
|
||||
// filename
|
||||
char tmp[255];
|
||||
@ -458,65 +458,65 @@ ESP_SDFile::ESP_SDFile(void* handle, bool isdir, bool iswritemode,
|
||||
_index = i;
|
||||
// esp3d_log("Opening File at index %d",_index);
|
||||
set = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// todo need also to add short filename
|
||||
const char* ESP_SDFile::shortname() const {
|
||||
static char sname[13];
|
||||
File ftmp = SD.open(_filename.c_str());
|
||||
if (ftmp) {
|
||||
ftmp.getSFN(sname, 12);
|
||||
ftmp.close();
|
||||
if (strlen(sname) == 0) {
|
||||
return _name.c_str();
|
||||
}
|
||||
return sname;
|
||||
static char sname[13];
|
||||
File ftmp = SD.open(_filename.c_str());
|
||||
if (ftmp) {
|
||||
ftmp.getSFN(sname, 12);
|
||||
ftmp.close();
|
||||
if (strlen(sname) == 0) {
|
||||
return _name.c_str();
|
||||
}
|
||||
return sname;
|
||||
} else {
|
||||
return _name.c_str();
|
||||
return _name.c_str();
|
||||
}
|
||||
}
|
||||
|
||||
void ESP_SDFile::close() {
|
||||
if (_index != -1) {
|
||||
// esp3d_log("Closing File at index %d", _index);
|
||||
tSDFile_handle[_index].close();
|
||||
// reopen if mode = write
|
||||
// udate size + date
|
||||
if (_iswritemode && !_isdir) {
|
||||
if (_index != -1) {
|
||||
// esp3d_log("Closing File at index %d", _index);
|
||||
tSDFile_handle[_index].close();
|
||||
// reopen if mode = write
|
||||
// udate size + date
|
||||
if (_iswritemode && !_isdir) {
|
||||
File ftmp = SD.open(_filename.c_str());
|
||||
if (ftmp) {
|
||||
_size = ftmp.size();
|
||||
_lastwrite = getDateTimeFile(ftmp);
|
||||
ftmp.close();
|
||||
}
|
||||
}
|
||||
tSDFile_handle[_index] = File();
|
||||
// esp3d_log("Closing File at index %d",_index);
|
||||
_index = -1;
|
||||
}
|
||||
}
|
||||
tSDFile_handle[_index] = File();
|
||||
// esp3d_log("Closing File at index %d",_index);
|
||||
_index = -1;
|
||||
}
|
||||
}
|
||||
|
||||
ESP_SDFile ESP_SDFile::openNextFile() {
|
||||
if ((_index == -1) || !_isdir) {
|
||||
esp3d_log("openNextFile failed");
|
||||
return ESP_SDFile();
|
||||
}
|
||||
File tmp = tSDFile_handle[_index].openNextFile();
|
||||
if (tmp) {
|
||||
char tmps[255];
|
||||
tmp.getName(tmps, 254);
|
||||
esp3d_log("tmp name :%s %s", tmps, (tmp.isDir()) ? "isDir" : "isFile");
|
||||
String s = _filename;
|
||||
if (s != "/") {
|
||||
if ((_index == -1) || !_isdir) {
|
||||
esp3d_log("openNextFile failed");
|
||||
return ESP_SDFile();
|
||||
}
|
||||
File tmp = tSDFile_handle[_index].openNextFile();
|
||||
if (tmp) {
|
||||
char tmps[255];
|
||||
tmp.getName(tmps, 254);
|
||||
esp3d_log("tmp name :%s %s", tmps, (tmp.isDir()) ? "isDir" : "isFile");
|
||||
String s = _filename;
|
||||
if (s != "/") {
|
||||
s += "/";
|
||||
}
|
||||
s += tmps;
|
||||
ESP_SDFile esptmp(&tmp, tmp.isDir(), false, s.c_str());
|
||||
esptmp.close();
|
||||
return esptmp;
|
||||
}
|
||||
return ESP_SDFile();
|
||||
}
|
||||
s += tmps;
|
||||
ESP_SDFile esptmp(&tmp, tmp.isDir(), false, s.c_str());
|
||||
esptmp.close();
|
||||
return esptmp;
|
||||
}
|
||||
return ESP_SDFile();
|
||||
}
|
||||
|
||||
const char* ESP_SD::FilesystemName() { return "SDFat - " SD_FAT_VERSION_STR; }
|
||||
|
@ -101,7 +101,8 @@ uint8_t ESP_SD::getState(bool refresh) {
|
||||
|
||||
bool ESP_SD::begin() {
|
||||
#if SDIO_BIT_MODE == SD_ONE_BIT_MODE
|
||||
#if (ESP_SDIO_CLK_PIN != -1) || (ESP_SDIO_CMD_PIN != -1) || (ESP_SDIO_D0_PIN != -1)
|
||||
#if (ESP_SDIO_CLK_PIN != -1) || (ESP_SDIO_CMD_PIN != -1) || \
|
||||
(ESP_SDIO_D0_PIN != -1)
|
||||
SD_MMC.setPins(ESP_SDIO_CLK_PIN, ESP_SDIO_CMD_PIN, ESP_SDIO_D0_PIN);
|
||||
#endif //(ESP_SDIO_CLK_PIN != -1)
|
||||
#else
|
||||
@ -112,7 +113,7 @@ bool ESP_SD::begin() {
|
||||
ESP_SDIO_D1_PIN, ESP_SDIO_D2_PIN, ESP_SDIO_D3_PIN);
|
||||
#endif //(ESP_SDIO_CLK_PIN != -1)
|
||||
#endif // SD_ONE_BIT_MODE
|
||||
esp3d_log("Begin SDIO");
|
||||
esp3d_log("Begin SDIO");
|
||||
_started = true;
|
||||
#ifdef SDMMC_FORCE_BEGIN
|
||||
_state = ESP_SDCARD_NOT_PRESENT;
|
||||
|
@ -32,55 +32,50 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#define STREAMING_LIBRARY_VERSION 5
|
||||
|
||||
// Generic template
|
||||
template<class T>
|
||||
inline Print &operator <<(Print &stream, T arg)
|
||||
{
|
||||
stream.print(arg);
|
||||
return stream;
|
||||
template <class T>
|
||||
inline Print &operator<<(Print &stream, T arg) {
|
||||
stream.print(arg);
|
||||
return stream;
|
||||
}
|
||||
|
||||
struct _BASED {
|
||||
long val;
|
||||
int base;
|
||||
_BASED(long v, int b): val(v), base(b)
|
||||
{}
|
||||
long val;
|
||||
int base;
|
||||
_BASED(long v, int b) : val(v), base(b) {}
|
||||
};
|
||||
|
||||
#if ARDUINO >= 100
|
||||
|
||||
struct _BYTE_CODE {
|
||||
byte val;
|
||||
_BYTE_CODE(byte v) : val(v)
|
||||
{}
|
||||
byte val;
|
||||
_BYTE_CODE(byte v) : val(v) {}
|
||||
};
|
||||
#define _BYTE(a) _BYTE_CODE(a)
|
||||
#define _BYTE(a) _BYTE_CODE(a)
|
||||
|
||||
inline Print &operator <<(Print &obj, const _BYTE_CODE &arg)
|
||||
{
|
||||
obj.write(arg.val);
|
||||
return obj;
|
||||
inline Print &operator<<(Print &obj, const _BYTE_CODE &arg) {
|
||||
obj.write(arg.val);
|
||||
return obj;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#define _BYTE(a) _BASED(a, BYTE)
|
||||
#define _BYTE(a) _BASED(a, BYTE)
|
||||
|
||||
#endif
|
||||
|
||||
#define _HEX(a) _BASED(a, HEX)
|
||||
#define _DEC(a) _BASED(a, DEC)
|
||||
#define _OCT(a) _BASED(a, OCT)
|
||||
#define _BIN(a) _BASED(a, BIN)
|
||||
#define _HEX(a) _BASED(a, HEX)
|
||||
#define _DEC(a) _BASED(a, DEC)
|
||||
#define _OCT(a) _BASED(a, OCT)
|
||||
#define _BIN(a) _BASED(a, BIN)
|
||||
|
||||
// Specialization for class _BASED
|
||||
// Thanks to Arduino forum user Ben Combee who suggested this
|
||||
// clever technique to allow for expressions like
|
||||
// Serial << _HEX(a);
|
||||
|
||||
inline Print &operator <<(Print &obj, const _BASED &arg)
|
||||
{
|
||||
obj.print(arg.val, arg.base);
|
||||
return obj;
|
||||
inline Print &operator<<(Print &obj, const _BASED &arg) {
|
||||
obj.print(arg.val, arg.base);
|
||||
return obj;
|
||||
}
|
||||
|
||||
#if ARDUINO >= 18
|
||||
@ -91,16 +86,14 @@ inline Print &operator <<(Print &obj, const _BASED &arg)
|
||||
// Serial << _FLOAT(gps_latitude, 6); // 6 digits of precision
|
||||
|
||||
struct _FLOAT {
|
||||
float val;
|
||||
int digits;
|
||||
_FLOAT(double v, int d): val(v), digits(d)
|
||||
{}
|
||||
float val;
|
||||
int digits;
|
||||
_FLOAT(double v, int d) : val(v), digits(d) {}
|
||||
};
|
||||
|
||||
inline Print &operator <<(Print &obj, const _FLOAT &arg)
|
||||
{
|
||||
obj.print(arg.val, arg.digits);
|
||||
return obj;
|
||||
inline Print &operator<<(Print &obj, const _FLOAT &arg) {
|
||||
obj.print(arg.val, arg.digits);
|
||||
return obj;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -118,11 +111,10 @@ inline Print &operator <<(Print &obj, _EndLineCode arg)
|
||||
|
||||
enum _EndLineCode { eol };
|
||||
|
||||
inline Print &operator <<(Print &obj, _EndLineCode arg)
|
||||
{
|
||||
(void)arg;
|
||||
obj.print( "\r\n" );
|
||||
return obj;
|
||||
inline Print &operator<<(Print &obj, _EndLineCode arg) {
|
||||
(void)arg;
|
||||
obj.print("\r\n");
|
||||
return obj;
|
||||
}
|
||||
|
||||
#endif // EXT_STREAMING_H
|
||||
#endif // EXT_STREAMING_H
|
||||
|
@ -18,14 +18,14 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* 2019-10-27 Modified version for ESP3D by Luc LEBOSSE @luc-github
|
||||
* support for ESP8266 and ESP32 in ESP3D project
|
||||
*/
|
||||
* 2019-10-27 Modified version for ESP3D by Luc LEBOSSE @luc-github
|
||||
* support for ESP8266 and ESP32 in ESP3D project
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
** **
|
||||
** DEFINITIONS FOR FTP SERVER **
|
||||
** **
|
||||
** **
|
||||
** DEFINITIONS FOR FTP SERVER **
|
||||
** **
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef FTP_SERVER_H
|
||||
@ -36,127 +36,123 @@ class WiFiClient;
|
||||
#ifndef FF_MAX_LFN
|
||||
#define FF_MAX_LFN 255
|
||||
#endif
|
||||
#define FTP_TIME_OUT 5 * 60 // Disconnect client after 5 minutes of inactivity
|
||||
#define FTP_AUTH_TIME_OUT 10 // Wait for authentication for 10 seconds
|
||||
#define FTP_CMD_SIZE FF_MAX_LFN+8 // max size of a command
|
||||
#define FTP_CWD_SIZE FF_MAX_LFN+8 // max size of a directory name
|
||||
#define FTP_FIL_SIZE FF_MAX_LFN // max size of a file name
|
||||
#define FTP_BUF_SIZE 1024 // 512 // size of file buffer for read/write
|
||||
#define FTP_TIME_OUT 5 * 60 // Disconnect client after 5 minutes of inactivity
|
||||
#define FTP_AUTH_TIME_OUT 10 // Wait for authentication for 10 seconds
|
||||
#define FTP_CMD_SIZE FF_MAX_LFN + 8 // max size of a command
|
||||
#define FTP_CWD_SIZE FF_MAX_LFN + 8 // max size of a directory name
|
||||
#define FTP_FIL_SIZE FF_MAX_LFN // max size of a file name
|
||||
#define FTP_BUF_SIZE 1024 // 512 // size of file buffer for read/write
|
||||
|
||||
#define FTP_SERVER WiFiServer
|
||||
#define FTP_CLIENT WiFiClient
|
||||
#define CommandIs( a ) (command != NULL && ! strcmp_P( command, PSTR( a )))
|
||||
#define ParameterIs( a ) ( parameter != NULL && ! strcmp_P( parameter, PSTR( a )))
|
||||
#define CommandIs(a) (command != NULL && !strcmp_P(command, PSTR(a)))
|
||||
#define ParameterIs(a) (parameter != NULL && !strcmp_P(parameter, PSTR(a)))
|
||||
#include <time.h>
|
||||
|
||||
enum ftpCmd { FTP_Stop = 0, // In this stage, stop any connection
|
||||
FTP_Init, // initialize some variables
|
||||
FTP_Client, // wait for client connection
|
||||
FTP_User, // wait for user name
|
||||
FTP_Pass, // wait for user password
|
||||
FTP_Cmd
|
||||
}; // answers to commands
|
||||
enum ftpCmd {
|
||||
FTP_Stop = 0, // In this stage, stop any connection
|
||||
FTP_Init, // initialize some variables
|
||||
FTP_Client, // wait for client connection
|
||||
FTP_User, // wait for user name
|
||||
FTP_Pass, // wait for user password
|
||||
FTP_Cmd
|
||||
}; // answers to commands
|
||||
|
||||
enum ftpTransfer { FTP_Close = 0, // In this stage, close data channel
|
||||
FTP_Retrieve, // retrieve file
|
||||
FTP_Store, // store file
|
||||
FTP_List, // list of files
|
||||
FTP_Nlst, // list of name of files
|
||||
FTP_Mlsd
|
||||
}; // listing for machine processing
|
||||
enum ftpTransfer {
|
||||
FTP_Close = 0, // In this stage, close data channel
|
||||
FTP_Retrieve, // retrieve file
|
||||
FTP_Store, // store file
|
||||
FTP_List, // list of files
|
||||
FTP_Nlst, // list of name of files
|
||||
FTP_Mlsd
|
||||
}; // listing for machine processing
|
||||
|
||||
enum ftpDataConn { FTP_NoConn = 0,// No data connexion
|
||||
FTP_Pasive, // Pasive type
|
||||
FTP_Active
|
||||
}; // Active type
|
||||
enum ftpDataConn {
|
||||
FTP_NoConn = 0, // No data connexion
|
||||
FTP_Pasive, // Pasive type
|
||||
FTP_Active
|
||||
}; // Active type
|
||||
|
||||
class FtpServer
|
||||
{
|
||||
public:
|
||||
FtpServer();
|
||||
~FtpServer();
|
||||
bool begin();
|
||||
void handle();
|
||||
void end();
|
||||
bool started();
|
||||
uint16_t ctrlport()
|
||||
{
|
||||
return ctrlPort;
|
||||
}
|
||||
uint16_t datapassiveport()
|
||||
{
|
||||
return passivePort;
|
||||
}
|
||||
uint16_t dataactiveport()
|
||||
{
|
||||
return activePort;
|
||||
}
|
||||
void closeClient();
|
||||
bool isConnected();
|
||||
const char* clientIPAddress();
|
||||
bool isUser(const char * user);
|
||||
bool isPassword(const char * password);
|
||||
bool accessFS(const char* path);
|
||||
void releaseFS();
|
||||
private:
|
||||
void iniVariables();
|
||||
void clientConnected();
|
||||
void disconnectClient();
|
||||
bool processCommand();
|
||||
bool haveParameter();
|
||||
int dataConnect( bool out150 = true );
|
||||
bool dataConnected();
|
||||
bool doRetrieve();
|
||||
bool doStore();
|
||||
bool doList();
|
||||
bool doMlsd();
|
||||
void closeTransfer();
|
||||
void abortTransfer();
|
||||
bool makePath( char * fullName, char * param = NULL );
|
||||
bool makeExistsPath( char * path, char * param = NULL );
|
||||
char * makeDateTimeStr( char * tstr, time_t timefile );
|
||||
char * makeDateTimeString( char * tstr, time_t timefile );
|
||||
uint8_t getDateTime( char * dt, uint16_t * pyear, uint8_t * pmonth, uint8_t * pday,
|
||||
uint8_t * phour, uint8_t * pminute, uint8_t * second );
|
||||
class FtpServer {
|
||||
public:
|
||||
FtpServer();
|
||||
~FtpServer();
|
||||
bool begin();
|
||||
void handle();
|
||||
void end();
|
||||
bool started();
|
||||
uint16_t ctrlport() { return ctrlPort; }
|
||||
uint16_t datapassiveport() { return passivePort; }
|
||||
uint16_t dataactiveport() { return activePort; }
|
||||
void closeClient();
|
||||
bool isConnected();
|
||||
const char* clientIPAddress();
|
||||
bool isUser(const char* user);
|
||||
bool isPassword(const char* password);
|
||||
bool accessFS(const char* path);
|
||||
void releaseFS();
|
||||
|
||||
bool getFileModTime(const char * path,time_t & time);
|
||||
bool timeStamp( const char * path, uint16_t year, uint8_t month, uint8_t day, uint8_t hour, uint8_t minute, uint8_t second );
|
||||
int8_t readChar();
|
||||
uint8_t _fsType;
|
||||
FTP_SERVER * ftpServer;
|
||||
FTP_SERVER * dataServer;
|
||||
uint16_t ctrlPort; // Command port on wich server is listening
|
||||
uint16_t activePort; // Default data port in active mode
|
||||
uint16_t passivePort; // Data port in passive mode
|
||||
bool _started;
|
||||
uint8_t _root;
|
||||
IPAddress dataIp; // IP address of client for data
|
||||
FTP_CLIENT client;
|
||||
FTP_CLIENT data;
|
||||
private:
|
||||
void iniVariables();
|
||||
void clientConnected();
|
||||
void disconnectClient();
|
||||
bool processCommand();
|
||||
bool haveParameter();
|
||||
int dataConnect(bool out150 = true);
|
||||
bool dataConnected();
|
||||
bool doRetrieve();
|
||||
bool doStore();
|
||||
bool doList();
|
||||
bool doMlsd();
|
||||
void closeTransfer();
|
||||
void abortTransfer();
|
||||
bool makePath(char* fullName, char* param = NULL);
|
||||
bool makeExistsPath(char* path, char* param = NULL);
|
||||
char* makeDateTimeStr(char* tstr, time_t timefile);
|
||||
char* makeDateTimeString(char* tstr, time_t timefile);
|
||||
uint8_t getDateTime(char* dt, uint16_t* pyear, uint8_t* pmonth, uint8_t* pday,
|
||||
uint8_t* phour, uint8_t* pminute, uint8_t* second);
|
||||
|
||||
ftpCmd cmdStage; // stage of ftp command connexion
|
||||
ftpTransfer transferStage; // stage of data connexion
|
||||
ftpDataConn dataConn; // type of data connexion
|
||||
bool getFileModTime(const char* path, time_t& time);
|
||||
bool timeStamp(const char* path, uint16_t year, uint8_t month, uint8_t day,
|
||||
uint8_t hour, uint8_t minute, uint8_t second);
|
||||
int8_t readChar();
|
||||
uint8_t _fsType;
|
||||
FTP_SERVER* ftpServer;
|
||||
FTP_SERVER* dataServer;
|
||||
uint16_t ctrlPort; // Command port on wich server is listening
|
||||
uint16_t activePort; // Default data port in active mode
|
||||
uint16_t passivePort; // Data port in passive mode
|
||||
bool _started;
|
||||
uint8_t _root;
|
||||
IPAddress dataIp; // IP address of client for data
|
||||
FTP_CLIENT client;
|
||||
FTP_CLIENT data;
|
||||
|
||||
// uint8_t __attribute__((packed, aligned(4))) // need to be aligned to 32bit for Esp8266 SPIClass::transferBytes()
|
||||
uint8_t buf[ FTP_BUF_SIZE ]; // data buffer for transfers
|
||||
char cmdLine[ FTP_CMD_SIZE ]; // where to store incoming char from client
|
||||
char cwdName[ FTP_CWD_SIZE ]; // name of current directory
|
||||
char rnfrName[ FTP_CWD_SIZE ]; // name of file for RNFR command
|
||||
char command[ 5 ]; // command sent by client
|
||||
bool rnfrCmd; // previous command was RNFR
|
||||
char * parameter; // point to begin of parameters sent by client
|
||||
uint16_t dataPort;
|
||||
uint16_t iCL; // pointer to cmdLine next incoming char
|
||||
uint16_t nbMatch;
|
||||
ftpCmd cmdStage; // stage of ftp command connexion
|
||||
ftpTransfer transferStage; // stage of data connexion
|
||||
ftpDataConn dataConn; // type of data connexion
|
||||
|
||||
uint32_t millisDelay, //
|
||||
millisEndConnection, //
|
||||
millisBeginTrans, // store time of beginning of a transaction
|
||||
bytesTransfered; //
|
||||
String _currentUser;
|
||||
// uint8_t __attribute__((packed, aligned(4))) // need to be aligned to 32bit
|
||||
// for Esp8266 SPIClass::transferBytes()
|
||||
uint8_t buf[FTP_BUF_SIZE]; // data buffer for transfers
|
||||
char cmdLine[FTP_CMD_SIZE]; // where to store incoming char from client
|
||||
char cwdName[FTP_CWD_SIZE]; // name of current directory
|
||||
char rnfrName[FTP_CWD_SIZE]; // name of file for RNFR command
|
||||
char command[5]; // command sent by client
|
||||
bool rnfrCmd; // previous command was RNFR
|
||||
char* parameter; // point to begin of parameters sent by client
|
||||
uint16_t dataPort;
|
||||
uint16_t iCL; // pointer to cmdLine next incoming char
|
||||
uint16_t nbMatch;
|
||||
|
||||
uint32_t millisDelay, //
|
||||
millisEndConnection, //
|
||||
millisBeginTrans, // store time of beginning of a transaction
|
||||
bytesTransfered; //
|
||||
String _currentUser;
|
||||
};
|
||||
|
||||
extern FtpServer ftp_server;
|
||||
|
||||
#endif // FTP_SERVER_H
|
||||
#endif // FTP_SERVER_H
|
||||
|
@ -495,7 +495,7 @@ bool GcodeHost::processScript(const char *line,
|
||||
ESP3DAuthenticationLevel auth_type) {
|
||||
if (_step != HOST_NO_STREAM) {
|
||||
esp3d_log("Streaming already in progress");
|
||||
while(_step != HOST_NO_STREAM){
|
||||
while (_step != HOST_NO_STREAM) {
|
||||
handle();
|
||||
}
|
||||
}
|
||||
@ -506,7 +506,7 @@ bool GcodeHost::processScript(const char *line,
|
||||
esp3d_log_e("No script to process");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
_fsType = TYPE_SCRIPT_STREAM;
|
||||
_step = HOST_START_STREAM;
|
||||
_auth_type = auth_type;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -20,29 +20,35 @@
|
||||
|
||||
#ifndef __favicon_h
|
||||
#define __favicon_h
|
||||
#define favicon_size 344
|
||||
#define favicon_size 344
|
||||
const unsigned char favicon[344] PROGMEM = {
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xb5, 0x94, 0x31, 0x4b, 0xc3, 0x50,
|
||||
0x14, 0x85, 0x4f, 0x63, 0xc1, 0x5a, 0x0b, 0x06, 0x91, 0x4e, 0x52, 0x3a, 0x44, 0x10, 0x27, 0x31,
|
||||
0x45, 0xdc, 0xec, 0xd4, 0xdf, 0x21, 0x99, 0x44, 0x1c, 0x44, 0x74, 0x17, 0x9c, 0x8a, 0x73, 0x7f,
|
||||
0x80, 0xbf, 0xa0, 0x63, 0x56, 0x1d, 0x1d, 0x9c, 0xa4, 0x74, 0x15, 0x1c, 0xc4, 0x4d, 0x90, 0x0e,
|
||||
0x52, 0xa5, 0x9e, 0x4b, 0x4f, 0xf0, 0x52, 0x13, 0xa8, 0x82, 0x2f, 0x7c, 0xcd, 0xcb, 0xb9, 0xe7,
|
||||
0xde, 0x77, 0xf3, 0x5e, 0x5b, 0xa0, 0xc4, 0x2b, 0x0c, 0xc1, 0xcf, 0x26, 0x0e, 0xcb, 0x40, 0x1d,
|
||||
0xc0, 0x26, 0xa1, 0x44, 0x65, 0xaa, 0xff, 0xd7, 0x78, 0x3b, 0x5f, 0x9e, 0x18, 0x79, 0xf3, 0x79,
|
||||
0x7d, 0x36, 0xbc, 0x2f, 0xbb, 0xc7, 0x71, 0xdc, 0x36, 0xf2, 0x62, 0xbe, 0x4e, 0x51, 0x5d, 0xd5,
|
||||
0x18, 0x93, 0xd5, 0xbc, 0xde, 0xbc, 0x36, 0xdb, 0xb3, 0x72, 0xaf, 0xa5, 0x05, 0xbf, 0x59, 0x9f,
|
||||
0x79, 0x4f, 0x4e, 0x0f, 0xf8, 0x9c, 0x14, 0xf5, 0x39, 0x3b, 0xe8, 0xdd, 0x25, 0xef, 0xc4, 0xea,
|
||||
0xbc, 0x88, 0x89, 0xb4, 0xbd, 0xa2, 0x73, 0x60, 0x2c, 0x22, 0x3d, 0xd2, 0x20, 0x2d, 0x92, 0x92,
|
||||
0x91, 0x48, 0xa5, 0x35, 0xe4, 0x89, 0x72, 0xf2, 0x13, 0xb7, 0xe6, 0x01, 0xa5, 0x8a, 0x0b, 0x57,
|
||||
0x4c, 0x73, 0xbd, 0x24, 0x2e, 0xaf, 0x4a, 0x3a, 0x9c, 0x96, 0x79, 0xef, 0x92, 0x4f, 0x79, 0x6c,
|
||||
0xdd, 0x7b, 0x31, 0x92, 0x66, 0xb1, 0xae, 0xbc, 0x1d, 0xe5, 0x9e, 0x29, 0xd6, 0x27, 0x21, 0xd9,
|
||||
0xb1, 0x7d, 0x77, 0x6b, 0x65, 0x3d, 0x99, 0xb6, 0x2d, 0x4f, 0x5f, 0xba, 0xe5, 0xae, 0x93, 0x81,
|
||||
0x9e, 0x9f, 0xc9, 0x09, 0x59, 0x53, 0x6f, 0x35, 0x43, 0xf3, 0x3a, 0x39, 0x75, 0x75, 0x1f, 0x2c,
|
||||
0xd7, 0xf9, 0x7a, 0xfa, 0xae, 0x64, 0x7d, 0x0e, 0xb4, 0x6f, 0xa9, 0xe6, 0xd9, 0x7b, 0x8d, 0xe5,
|
||||
0xad, 0x15, 0x9c, 0xc1, 0x15, 0x19, 0x3a, 0x7f, 0x56, 0x6f, 0xa8, 0xd8, 0x8f, 0xbd, 0x2f, 0x38,
|
||||
0x4f, 0xdb, 0x9b, 0xa6, 0xa8, 0xce, 0x93, 0xf3, 0x97, 0x61, 0xbf, 0xbc, 0x8d, 0x3b, 0xa0, 0x75,
|
||||
0x04, 0x44, 0x5c, 0xe5, 0x78, 0x8b, 0xff, 0x19, 0x4b, 0xc0, 0xeb, 0x0a, 0x70, 0xb3, 0x00, 0xdc,
|
||||
0x5e, 0x7e, 0x7b, 0x83, 0x36, 0x70, 0x51, 0x02, 0x1e, 0x17, 0x81, 0x8f, 0xfd, 0x69, 0xee, 0x17,
|
||||
0xbf, 0xe1, 0x18, 0x97, 0x7e, 0x04, 0x00, 0x00
|
||||
};
|
||||
#endif //__favicon_h
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xb5, 0x94,
|
||||
0x31, 0x4b, 0xc3, 0x50, 0x14, 0x85, 0x4f, 0x63, 0xc1, 0x5a, 0x0b, 0x06,
|
||||
0x91, 0x4e, 0x52, 0x3a, 0x44, 0x10, 0x27, 0x31, 0x45, 0xdc, 0xec, 0xd4,
|
||||
0xdf, 0x21, 0x99, 0x44, 0x1c, 0x44, 0x74, 0x17, 0x9c, 0x8a, 0x73, 0x7f,
|
||||
0x80, 0xbf, 0xa0, 0x63, 0x56, 0x1d, 0x1d, 0x9c, 0xa4, 0x74, 0x15, 0x1c,
|
||||
0xc4, 0x4d, 0x90, 0x0e, 0x52, 0xa5, 0x9e, 0x4b, 0x4f, 0xf0, 0x52, 0x13,
|
||||
0xa8, 0x82, 0x2f, 0x7c, 0xcd, 0xcb, 0xb9, 0xe7, 0xde, 0x77, 0xf3, 0x5e,
|
||||
0x5b, 0xa0, 0xc4, 0x2b, 0x0c, 0xc1, 0xcf, 0x26, 0x0e, 0xcb, 0x40, 0x1d,
|
||||
0xc0, 0x26, 0xa1, 0x44, 0x65, 0xaa, 0xff, 0xd7, 0x78, 0x3b, 0x5f, 0x9e,
|
||||
0x18, 0x79, 0xf3, 0x79, 0x7d, 0x36, 0xbc, 0x2f, 0xbb, 0xc7, 0x71, 0xdc,
|
||||
0x36, 0xf2, 0x62, 0xbe, 0x4e, 0x51, 0x5d, 0xd5, 0x18, 0x93, 0xd5, 0xbc,
|
||||
0xde, 0xbc, 0x36, 0xdb, 0xb3, 0x72, 0xaf, 0xa5, 0x05, 0xbf, 0x59, 0x9f,
|
||||
0x79, 0x4f, 0x4e, 0x0f, 0xf8, 0x9c, 0x14, 0xf5, 0x39, 0x3b, 0xe8, 0xdd,
|
||||
0x25, 0xef, 0xc4, 0xea, 0xbc, 0x88, 0x89, 0xb4, 0xbd, 0xa2, 0x73, 0x60,
|
||||
0x2c, 0x22, 0x3d, 0xd2, 0x20, 0x2d, 0x92, 0x92, 0x91, 0x48, 0xa5, 0x35,
|
||||
0xe4, 0x89, 0x72, 0xf2, 0x13, 0xb7, 0xe6, 0x01, 0xa5, 0x8a, 0x0b, 0x57,
|
||||
0x4c, 0x73, 0xbd, 0x24, 0x2e, 0xaf, 0x4a, 0x3a, 0x9c, 0x96, 0x79, 0xef,
|
||||
0x92, 0x4f, 0x79, 0x6c, 0xdd, 0x7b, 0x31, 0x92, 0x66, 0xb1, 0xae, 0xbc,
|
||||
0x1d, 0xe5, 0x9e, 0x29, 0xd6, 0x27, 0x21, 0xd9, 0xb1, 0x7d, 0x77, 0x6b,
|
||||
0x65, 0x3d, 0x99, 0xb6, 0x2d, 0x4f, 0x5f, 0xba, 0xe5, 0xae, 0x93, 0x81,
|
||||
0x9e, 0x9f, 0xc9, 0x09, 0x59, 0x53, 0x6f, 0x35, 0x43, 0xf3, 0x3a, 0x39,
|
||||
0x75, 0x75, 0x1f, 0x2c, 0xd7, 0xf9, 0x7a, 0xfa, 0xae, 0x64, 0x7d, 0x0e,
|
||||
0xb4, 0x6f, 0xa9, 0xe6, 0xd9, 0x7b, 0x8d, 0xe5, 0xad, 0x15, 0x9c, 0xc1,
|
||||
0x15, 0x19, 0x3a, 0x7f, 0x56, 0x6f, 0xa8, 0xd8, 0x8f, 0xbd, 0x2f, 0x38,
|
||||
0x4f, 0xdb, 0x9b, 0xa6, 0xa8, 0xce, 0x93, 0xf3, 0x97, 0x61, 0xbf, 0xbc,
|
||||
0x8d, 0x3b, 0xa0, 0x75, 0x04, 0x44, 0x5c, 0xe5, 0x78, 0x8b, 0xff, 0x19,
|
||||
0x4b, 0xc0, 0xeb, 0x0a, 0x70, 0xb3, 0x00, 0xdc, 0x5e, 0x7e, 0x7b, 0x83,
|
||||
0x36, 0x70, 0x51, 0x02, 0x1e, 0x17, 0x81, 0x8f, 0xfd, 0x69, 0xee, 0x17,
|
||||
0xbf, 0xe1, 0x18, 0x97, 0x7e, 0x04, 0x00, 0x00};
|
||||
#endif //__favicon_h
|
@ -27,9 +27,9 @@
|
||||
#if defined(ARDUINO_ARCH_ESP8266)
|
||||
#include <ESP8266WebServer.h>
|
||||
#endif // ARDUINO_ARCH_ESP8266
|
||||
#include "../../../core/esp3d_string.h"
|
||||
#include "../../authentication/authentication_service.h"
|
||||
#include "../../filesystem/esp_sd.h"
|
||||
#include "../../../core/esp3d_string.h"
|
||||
|
||||
// SD
|
||||
// SD files list and file commands
|
||||
@ -239,9 +239,9 @@ void HTTP_Server::handleSDFileList() {
|
||||
buffer2send += "\"occupation\":\"0\",";
|
||||
}
|
||||
buffer2send += "\"status\":\"" + status + "\",";
|
||||
buffer2send += "\"total\":\"" ;
|
||||
buffer2send += esp3d_string::formatBytes(ESP_SD::totalBytes()) ;
|
||||
buffer2send += "\",";
|
||||
buffer2send += "\"total\":\"";
|
||||
buffer2send += esp3d_string::formatBytes(ESP_SD::totalBytes());
|
||||
buffer2send += "\",";
|
||||
buffer2send += "\"used\":\"";
|
||||
buffer2send += esp3d_string::formatBytes(ESP_SD::usedBytes());
|
||||
buffer2send += "\"}";
|
||||
|
@ -18,29 +18,28 @@
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
#include "../../../include/esp3d_config.h"
|
||||
#if defined (HTTP_FEATURE) && defined (SSDP_FEATURE)
|
||||
#if defined(HTTP_FEATURE) && defined(SSDP_FEATURE)
|
||||
#include "../http_server.h"
|
||||
#if defined (ARDUINO_ARCH_ESP32)
|
||||
#if defined(ARDUINO_ARCH_ESP32)
|
||||
#include <WebServer.h>
|
||||
#ifdef SSDP_FEATURE
|
||||
#include <ESP32SSDP.h>
|
||||
#endif //SSDP_FEATURE
|
||||
#endif //ARDUINO_ARCH_ESP32
|
||||
#if defined (ARDUINO_ARCH_ESP8266)
|
||||
#endif // SSDP_FEATURE
|
||||
#endif // ARDUINO_ARCH_ESP32
|
||||
#if defined(ARDUINO_ARCH_ESP8266)
|
||||
#include <ESP8266WebServer.h>
|
||||
#ifdef SSDP_FEATURE
|
||||
#include <ESP8266SSDP.h>
|
||||
#endif //SSDP_FEATURE
|
||||
#endif //ARDUINO_ARCH_ESP8266
|
||||
void HTTP_Server::handle_SSDP()
|
||||
{
|
||||
if (_webserver) {
|
||||
#if defined (ARDUINO_ARCH_ESP32)
|
||||
_webserver->send(200, "text/xml", SSDP.getSchema());
|
||||
#endif //ARDUINO_ARCH_ESP32
|
||||
#if defined (ARDUINO_ARCH_ESP8266)
|
||||
SSDP.schema(_webserver->client());
|
||||
#endif //ARDUINO_ARCH_ESP8266
|
||||
}
|
||||
#endif // SSDP_FEATURE
|
||||
#endif // ARDUINO_ARCH_ESP8266
|
||||
void HTTP_Server::handle_SSDP() {
|
||||
if (_webserver) {
|
||||
#if defined(ARDUINO_ARCH_ESP32)
|
||||
_webserver->send(200, "text/xml", SSDP.getSchema());
|
||||
#endif // ARDUINO_ARCH_ESP32
|
||||
#if defined(ARDUINO_ARCH_ESP8266)
|
||||
SSDP.schema(_webserver->client());
|
||||
#endif // ARDUINO_ARCH_ESP8266
|
||||
}
|
||||
}
|
||||
#endif //HTTP_FEATURE && SSDP_FEATURE
|
||||
#endif // HTTP_FEATURE && SSDP_FEATURE
|
||||
|
@ -20,21 +20,19 @@
|
||||
#ifndef _INPUT_H
|
||||
#define _INPUT_H
|
||||
|
||||
class Input {
|
||||
public:
|
||||
Input();
|
||||
~Input();
|
||||
bool begin();
|
||||
void end();
|
||||
void handle();
|
||||
bool started();
|
||||
|
||||
class Input
|
||||
{
|
||||
public:
|
||||
Input();
|
||||
~Input();
|
||||
bool begin();
|
||||
void end();
|
||||
void handle();
|
||||
bool started();
|
||||
private:
|
||||
bool _started;
|
||||
private:
|
||||
bool _started;
|
||||
};
|
||||
|
||||
extern Input esp3d_input;
|
||||
|
||||
#endif //_INPUT_H
|
||||
|
||||
#endif //_INPUT_H
|
||||
|
@ -20,21 +20,17 @@
|
||||
#ifndef _LUA_INTERPRETER_H
|
||||
#define _LUA_INTERPRETER_H
|
||||
|
||||
class LuaInterpreter {
|
||||
public:
|
||||
LuaInterpreter();
|
||||
~LuaInterpreter();
|
||||
bool started() { return _started; }
|
||||
bool begin();
|
||||
void end();
|
||||
void handle();
|
||||
|
||||
class LuaInterpreter
|
||||
{
|
||||
public:
|
||||
LuaInterpreter();
|
||||
~LuaInterpreter();
|
||||
bool started()
|
||||
{
|
||||
return _started;
|
||||
}
|
||||
bool begin();
|
||||
void end();
|
||||
void handle();
|
||||
private:
|
||||
bool _started;
|
||||
private:
|
||||
bool _started;
|
||||
};
|
||||
extern LuaInterpreter esp3d_lua_interpreter;
|
||||
#endif //_LUA_INTERPRETER_H
|
||||
#endif //_LUA_INTERPRETER_H
|
||||
|
@ -20,35 +20,32 @@
|
||||
#ifndef _MDNS_H
|
||||
#define _MDNS_H
|
||||
#include <Arduino.h>
|
||||
class mDNS_Service
|
||||
{
|
||||
public:
|
||||
mDNS_Service();
|
||||
~mDNS_Service();
|
||||
bool started()
|
||||
{
|
||||
return _started;
|
||||
}
|
||||
bool begin(const char * hostname);
|
||||
void end();
|
||||
void handle();
|
||||
void addESP3DServices(uint16_t port);
|
||||
uint16_t servicesCount();
|
||||
const char* answerHostname(uint16_t index);
|
||||
const char* answerIP(uint16_t index);
|
||||
uint16_t answerPort(uint16_t index);
|
||||
uint16_t answerTxtCount(uint16_t index);
|
||||
const char* answerTxtKey(uint16_t index, uint16_t txtIndex);
|
||||
const char* answerTxt(uint16_t index, uint16_t txtIndex);
|
||||
private:
|
||||
bool _started;
|
||||
uint16_t _port;
|
||||
uint16_t _currentQueryCount;
|
||||
uint16_t _currentQueryTxtCount;
|
||||
String _hostname;
|
||||
class mDNS_Service {
|
||||
public:
|
||||
mDNS_Service();
|
||||
~mDNS_Service();
|
||||
bool started() { return _started; }
|
||||
bool begin(const char* hostname);
|
||||
void end();
|
||||
void handle();
|
||||
void addESP3DServices(uint16_t port);
|
||||
uint16_t servicesCount();
|
||||
const char* answerHostname(uint16_t index);
|
||||
const char* answerIP(uint16_t index);
|
||||
uint16_t answerPort(uint16_t index);
|
||||
uint16_t answerTxtCount(uint16_t index);
|
||||
const char* answerTxtKey(uint16_t index, uint16_t txtIndex);
|
||||
const char* answerTxt(uint16_t index, uint16_t txtIndex);
|
||||
|
||||
private:
|
||||
bool _started;
|
||||
uint16_t _port;
|
||||
uint16_t _currentQueryCount;
|
||||
uint16_t _currentQueryTxtCount;
|
||||
String _hostname;
|
||||
#if defined(ARDUINO_ARCH_ESP8266)
|
||||
const void* _hMDNSServiceQuery;
|
||||
#endif //ARDUINO_ARCH_ESP8266
|
||||
const void* _hMDNSServiceQuery;
|
||||
#endif // ARDUINO_ARCH_ESP8266
|
||||
};
|
||||
extern mDNS_Service esp3d_mDNS;
|
||||
#endif //_MDNS_H
|
||||
#endif //_MDNS_H
|
||||
|
@ -46,7 +46,7 @@
|
||||
#include "netservices.h"
|
||||
#if defined(GCODE_HOST_FEATURE)
|
||||
#include "../gcode_host/gcode_host.h"
|
||||
#endif // GCODE_HOST_FEATURE
|
||||
#endif // GCODE_HOST_FEATURE
|
||||
|
||||
String NetConfig::_hostname = "";
|
||||
bool NetConfig::_needReconnect2AP = false;
|
||||
@ -214,11 +214,12 @@ void NetConfig::onWiFiEvent(WiFiEvent_t event) {
|
||||
} break;
|
||||
case WIFI_EVENT_STAMODE_GOT_IP: {
|
||||
#if COMMUNICATION_PROTOCOL != MKS_SERIAL
|
||||
#if defined (ESP_GOT_IP_HOOK) && defined (GCODE_HOST_FEATURE)
|
||||
#if defined(ESP_GOT_IP_HOOK) && defined(GCODE_HOST_FEATURE)
|
||||
String ipMsg = esp3d_string::expandString(ESP_GOT_IP_HOOK);
|
||||
esp3d_log("Got IP, sending hook: %s", ipMsg.c_str());
|
||||
esp3d_gcode_host.processScript(ipMsg.c_str(), ESP3DAuthenticationLevel::admin);
|
||||
#endif // #if defined (ESP_GOT_IP_HOOK) && defined (GCODE_HOST_FEATURE)
|
||||
esp3d_gcode_host.processScript(ipMsg.c_str(),
|
||||
ESP3DAuthenticationLevel::admin);
|
||||
#endif // #if defined (ESP_GOT_IP_HOOK) && defined (GCODE_HOST_FEATURE)
|
||||
#endif // #if COMMUNICATION_PROTOCOL == MKS_SERIAL
|
||||
} break;
|
||||
case WIFI_EVENT_SOFTAPMODE_STACONNECTED: {
|
||||
@ -256,17 +257,17 @@ void NetConfig::onWiFiEvent(WiFiEvent_t event) {
|
||||
ESP3DAuthenticationLevel::admin);
|
||||
EthConfig::setConnected(false);
|
||||
} break;
|
||||
case ARDUINO_EVENT_ETH_GOT_IP:{
|
||||
case ARDUINO_EVENT_ETH_GOT_IP: {
|
||||
#if COMMUNICATION_PROTOCOL != MKS_SERIAL
|
||||
#if defined (ESP_GOT_IP_HOOK) && defined (GCODE_HOST_FEATURE)
|
||||
#if defined(ESP_GOT_IP_HOOK) && defined(GCODE_HOST_FEATURE)
|
||||
String ipMsg = esp3d_string::expandString(ESP_GOT_IP_HOOK);
|
||||
esp3d_log("Got IP, sending hook: %s", ipMsg.c_str());
|
||||
esp3d_gcode_host.processScript(ipMsg.c_str(), ESP3DAuthenticationLevel::admin);
|
||||
#endif // #if defined (ESP_GOT_IP_HOOK) && defined (GCODE_HOST_FEATURE)
|
||||
esp3d_log("Got IP, sending hook: %s", ipMsg.c_str());
|
||||
esp3d_gcode_host.processScript(ipMsg.c_str(),
|
||||
ESP3DAuthenticationLevel::admin);
|
||||
#endif // #if defined (ESP_GOT_IP_HOOK) && defined (GCODE_HOST_FEATURE)
|
||||
#endif // #if COMMUNICATION_PROTOCOL == MKS_SERIAL
|
||||
EthConfig::setConnected(true);
|
||||
}
|
||||
break;
|
||||
} break;
|
||||
case ARDUINO_EVENT_ETH_STOP:
|
||||
EthConfig::setConnected(false);
|
||||
break;
|
||||
|
@ -488,8 +488,9 @@ void NetServices::handle() {
|
||||
#ifdef NOTIFICATION_FEATURE
|
||||
notificationsservice.handle();
|
||||
#endif // NOTIFICATION_FEATURE
|
||||
#if defined (TIMESTAMP_FEATURE) && (defined (ESP_GOT_IP_HOOK) || defined (ESP_GOT_DATE_TIME_HOOK))
|
||||
timeService.handle();
|
||||
#if defined(TIMESTAMP_FEATURE) && \
|
||||
(defined(ESP_GOT_IP_HOOK) || defined(ESP_GOT_DATE_TIME_HOOK))
|
||||
timeService.handle();
|
||||
#endif // TIMESTAMP_FEATURE
|
||||
}
|
||||
if (_restart) {
|
||||
|
@ -18,26 +18,19 @@
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef _NET_SERVICES_H
|
||||
#define _NET_SERVICES_H
|
||||
|
||||
class NetServices {
|
||||
public:
|
||||
static bool begin();
|
||||
static void end();
|
||||
static void handle();
|
||||
static bool started() { return _started; }
|
||||
|
||||
class NetServices
|
||||
{
|
||||
public:
|
||||
static bool begin();
|
||||
static void end();
|
||||
static void handle();
|
||||
static bool started()
|
||||
{
|
||||
return _started;
|
||||
}
|
||||
private:
|
||||
static bool _started;
|
||||
static bool _restart;
|
||||
private:
|
||||
static bool _started;
|
||||
static bool _restart;
|
||||
};
|
||||
|
||||
#endif //_NET_SERVICES_H
|
||||
|
||||
#endif //_NET_SERVICES_H
|
||||
|
@ -102,9 +102,8 @@ void NotificationsService::BearSSLSetup(WiFiClientSecure& Notificationclient) {
|
||||
#endif // ARDUINO_ARCH_ESP8266
|
||||
|
||||
// TODO: put error in variable to allow better error handling
|
||||
template<typename T>
|
||||
bool NotificationsService::Wait4Answer(T& client,
|
||||
const char* linetrigger,
|
||||
template <typename T>
|
||||
bool NotificationsService::Wait4Answer(T& client, const char* linetrigger,
|
||||
const char* expected_answer,
|
||||
uint32_t timeout) {
|
||||
if (client.connected()) {
|
||||
@ -184,15 +183,15 @@ bool NotificationsService::sendMSG(const char* title, const char* messagetxt) {
|
||||
if (!((strlen(title) == 0) && (strlen(messagetxt) == 0))) {
|
||||
String message = esp3d_string::expandString(messagetxt);
|
||||
if (_notificationType != ESP_HOMEASSISTANT_NOTIFICATION) {
|
||||
// push to webui by default
|
||||
#if defined(HTTP_FEATURE) || defined(WS_DATA_FEATURE)
|
||||
String msg = "NOTIFICATION:";
|
||||
msg += message;
|
||||
websocket_terminal_server.pushMSG(msg.c_str());
|
||||
#endif // HTTP_FEATURE || WS_DATA_FEATURE
|
||||
#ifdef DISPLAY_DEVICE
|
||||
esp3d_display.setStatus(message.c_str());
|
||||
#endif // DISPLAY_DEVICE
|
||||
// push to webui by default
|
||||
#if defined(HTTP_FEATURE) || defined(WS_DATA_FEATURE)
|
||||
String msg = "NOTIFICATION:";
|
||||
msg += message;
|
||||
websocket_terminal_server.pushMSG(msg.c_str());
|
||||
#endif // HTTP_FEATURE || WS_DATA_FEATURE
|
||||
#ifdef DISPLAY_DEVICE
|
||||
esp3d_display.setStatus(message.c_str());
|
||||
#endif // DISPLAY_DEVICE
|
||||
}
|
||||
switch (_notificationType) {
|
||||
case ESP_PUSHOVER_NOTIFICATION:
|
||||
@ -504,7 +503,7 @@ bool NotificationsService::sendIFTTTMSG(const char* title,
|
||||
|
||||
// Home Assistant
|
||||
bool NotificationsService::sendHomeAssistantMSG(const char* title,
|
||||
const char* message) {
|
||||
const char* message) {
|
||||
WiFiClient Notificationclient;
|
||||
(void)title;
|
||||
if (!Notificationclient.connect(_serveraddress.c_str(), _port)) {
|
||||
@ -518,21 +517,32 @@ bool NotificationsService::sendHomeAssistantMSG(const char* title,
|
||||
String path = tmp.substring(0, pos);
|
||||
String json = tmp.substring(pos + 1);
|
||||
// build post query
|
||||
String postcmd = "POST " + path + " HTTP/1.1\r\n"
|
||||
"Host: " + _serveraddress.c_str() + "\r\n"
|
||||
"Connection: close\r\n"
|
||||
"Cache-Control: no-cache\r\n"
|
||||
"User-Agent: ESP3D\r\n"
|
||||
"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n"
|
||||
"Authorization: Bearer " + _token1 + "\r\n"
|
||||
"Content-Type: application/json\r\n"
|
||||
"Content-Length: " + json.length() + "\r\n"
|
||||
"\r\n" + json;
|
||||
String postcmd =
|
||||
"POST " + path +
|
||||
" HTTP/1.1\r\n"
|
||||
"Host: " +
|
||||
_serveraddress.c_str() +
|
||||
"\r\n"
|
||||
"Connection: close\r\n"
|
||||
"Cache-Control: no-cache\r\n"
|
||||
"User-Agent: ESP3D\r\n"
|
||||
"Accept: "
|
||||
"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n"
|
||||
"Authorization: Bearer " +
|
||||
_token1 +
|
||||
"\r\n"
|
||||
"Content-Type: application/json\r\n"
|
||||
"Content-Length: " +
|
||||
json.length() +
|
||||
"\r\n"
|
||||
"\r\n" +
|
||||
json;
|
||||
|
||||
// esp3d_log("Query: %s", postcmd.c_str());
|
||||
// send query
|
||||
Notificationclient.print(postcmd);
|
||||
bool res = Wait4Answer(Notificationclient, "200 OK", "200 OK", HOMEASSISTANTTIMEOUT);
|
||||
bool res =
|
||||
Wait4Answer(Notificationclient, "200 OK", "200 OK", HOMEASSISTANTTIMEOUT);
|
||||
Notificationclient.stop();
|
||||
return res;
|
||||
}
|
||||
@ -555,7 +565,7 @@ bool NotificationsService::getPortFromSettings() {
|
||||
// Email#serveraddress:port or serveraddress:port
|
||||
bool NotificationsService::getServerAddressFromSettings() {
|
||||
String tmp = ESP3DSettings::readString(ESP_NOTIFICATION_SETTINGS);
|
||||
int pos1 = tmp.indexOf('#'); // The "#" is optional
|
||||
int pos1 = tmp.indexOf('#'); // The "#" is optional
|
||||
int pos2 = tmp.lastIndexOf(':');
|
||||
if (pos2 == -1) return false;
|
||||
_serveraddress = tmp.substring(pos1 + 1, pos2);
|
||||
|
@ -60,7 +60,7 @@ class NotificationsService {
|
||||
bool getPortFromSettings();
|
||||
bool getServerAddressFromSettings();
|
||||
bool getEmailFromSettings();
|
||||
template<typename T>
|
||||
template <typename T>
|
||||
bool Wait4Answer(T& client, const char* linetrigger,
|
||||
const char* expected_answer, uint32_t timeout);
|
||||
};
|
||||
|
@ -18,26 +18,23 @@
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef _RECOVERY_SERVICE_H
|
||||
#define _RECOVERY_SERVICE_H
|
||||
|
||||
class RecoveryService
|
||||
{
|
||||
public:
|
||||
RecoveryService();
|
||||
~RecoveryService();
|
||||
bool begin();
|
||||
void end();
|
||||
void handle();
|
||||
bool started();
|
||||
private:
|
||||
bool _started;
|
||||
uint32_t _servicetimeout;
|
||||
class RecoveryService {
|
||||
public:
|
||||
RecoveryService();
|
||||
~RecoveryService();
|
||||
bool begin();
|
||||
void end();
|
||||
void handle();
|
||||
bool started();
|
||||
|
||||
private:
|
||||
bool _started;
|
||||
uint32_t _servicetimeout;
|
||||
};
|
||||
|
||||
extern RecoveryService recovery_service;
|
||||
|
||||
#endif //_RECOVERY_SERVICE_H
|
||||
|
||||
#endif //_RECOVERY_SERVICE_H
|
||||
|
@ -18,28 +18,24 @@
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef _ANALOG_SENSOR_H
|
||||
#define _ANALOG_SENSOR_H
|
||||
|
||||
#include "sensor.h"
|
||||
|
||||
class AnalogSensorDevice : ESP3DSensorDevice
|
||||
{
|
||||
public:
|
||||
AnalogSensorDevice();
|
||||
~AnalogSensorDevice();
|
||||
bool begin();
|
||||
void end();
|
||||
bool isModelValid(uint8_t model);
|
||||
uint8_t getIDFromString(const char *);
|
||||
uint8_t nbType();
|
||||
uint8_t GetModel(uint8_t i=0);
|
||||
const char *GetModelString(uint8_t i=0);
|
||||
const char *GetCurrentModelString();
|
||||
const char * GetData();
|
||||
class AnalogSensorDevice : ESP3DSensorDevice {
|
||||
public:
|
||||
AnalogSensorDevice();
|
||||
~AnalogSensorDevice();
|
||||
bool begin();
|
||||
void end();
|
||||
bool isModelValid(uint8_t model);
|
||||
uint8_t getIDFromString(const char *);
|
||||
uint8_t nbType();
|
||||
uint8_t GetModel(uint8_t i = 0);
|
||||
const char *GetModelString(uint8_t i = 0);
|
||||
const char *GetCurrentModelString();
|
||||
const char *GetData();
|
||||
};
|
||||
|
||||
#endif //_ANALOG_SENSOR_H
|
||||
|
||||
#endif //_ANALOG_SENSOR_H
|
||||
|
@ -117,16 +117,16 @@ uint8_t BMX280SensorDevice::GetModel(uint8_t i) {
|
||||
const char *BMX280SensorDevice::GetCurrentModelString() {
|
||||
uint8_t sensortype = ESP3DSettings::readByte(ESP_SENSOR_TYPE);
|
||||
for (uint8_t i = 0; i < NB_TYPE_SENSOR; i++) {
|
||||
if (sensortype == SENSOR_ID[i]) {
|
||||
if (sensortype == SENSOR_ID[i]) {
|
||||
return SENSOR_NAME[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
return "NONE";
|
||||
}
|
||||
|
||||
const char *BMX280SensorDevice::GetModelString(uint8_t i) {
|
||||
if (i < NB_TYPE_SENSOR) {
|
||||
return SENSOR_NAME[i];
|
||||
return SENSOR_NAME[i];
|
||||
}
|
||||
return "NONE";
|
||||
}
|
||||
@ -137,48 +137,48 @@ float toFahrenheit(float fromCelcius) { return 1.8 * fromCelcius + 32.0; };
|
||||
const char *BMX280SensorDevice::GetData() {
|
||||
static String s;
|
||||
if (bmx280_device) {
|
||||
if (!bmx280_device->measure()) {
|
||||
s = "BUSY";
|
||||
esp3d_log("sensor is busy");
|
||||
} else {
|
||||
uint8_t nbtry = 0;
|
||||
do {
|
||||
esp3d_log("try sensor %d", nbtry);
|
||||
ESP3DHal::wait(100);
|
||||
nbtry++;
|
||||
} while (!bmx280_device->hasValue() && nbtry < 3);
|
||||
if (bmx280_device->hasValue()) {
|
||||
float temperature = bmx280_device->getTemperature();
|
||||
float pressure = bmx280_device->getPressure();
|
||||
float humidity = 0;
|
||||
if (bmx280_device->isBME280()) {
|
||||
humidity = bmx280_device->getHumidity();
|
||||
}
|
||||
esp3d_log("T %f P %f H %f", temperature, pressure, humidity);
|
||||
if (String(temperature, 1) != "nan") {
|
||||
if (strcmp(SENSOR__UNIT, "F") == 0) {
|
||||
temperature = toFahrenheit(temperature);
|
||||
}
|
||||
s = String(temperature, 1);
|
||||
s += "[";
|
||||
s += SENSOR__UNIT;
|
||||
s += "] " + String(pressure, 1);
|
||||
s += "[Pa]";
|
||||
if (bmx280_device->isBME280()) {
|
||||
s += " " + String(humidity, 1) + "[%]";
|
||||
}
|
||||
} else {
|
||||
s = "DISCONNECTED";
|
||||
esp3d_log_e("No valid data");
|
||||
}
|
||||
} else {
|
||||
s = "DISCONNECTED";
|
||||
esp3d_log_e("No valid data");
|
||||
}
|
||||
if (!bmx280_device->measure()) {
|
||||
s = "BUSY";
|
||||
esp3d_log("sensor is busy");
|
||||
} else {
|
||||
uint8_t nbtry = 0;
|
||||
do {
|
||||
esp3d_log("try sensor %d", nbtry);
|
||||
ESP3DHal::wait(100);
|
||||
nbtry++;
|
||||
} while (!bmx280_device->hasValue() && nbtry < 3);
|
||||
if (bmx280_device->hasValue()) {
|
||||
float temperature = bmx280_device->getTemperature();
|
||||
float pressure = bmx280_device->getPressure();
|
||||
float humidity = 0;
|
||||
if (bmx280_device->isBME280()) {
|
||||
humidity = bmx280_device->getHumidity();
|
||||
}
|
||||
} else {
|
||||
esp3d_log("T %f P %f H %f", temperature, pressure, humidity);
|
||||
if (String(temperature, 1) != "nan") {
|
||||
if (strcmp(SENSOR__UNIT, "F") == 0) {
|
||||
temperature = toFahrenheit(temperature);
|
||||
}
|
||||
s = String(temperature, 1);
|
||||
s += "[";
|
||||
s += SENSOR__UNIT;
|
||||
s += "] " + String(pressure, 1);
|
||||
s += "[Pa]";
|
||||
if (bmx280_device->isBME280()) {
|
||||
s += " " + String(humidity, 1) + "[%]";
|
||||
}
|
||||
} else {
|
||||
s = "DISCONNECTED";
|
||||
esp3d_log_e("No valid data");
|
||||
}
|
||||
} else {
|
||||
s = "DISCONNECTED";
|
||||
esp3d_log_e("No device");
|
||||
esp3d_log_e("No valid data");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
s = "DISCONNECTED";
|
||||
esp3d_log_e("No device");
|
||||
}
|
||||
return s.c_str();
|
||||
}
|
||||
|
@ -18,27 +18,23 @@
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef _BMX280_SENSOR_H
|
||||
#define _BMX280_SENSOR_H
|
||||
#include "sensor.h"
|
||||
|
||||
class BMX280SensorDevice : ESP3DSensorDevice
|
||||
{
|
||||
public:
|
||||
BMX280SensorDevice();
|
||||
~BMX280SensorDevice();
|
||||
bool begin();
|
||||
void end();
|
||||
bool isModelValid(uint8_t model);
|
||||
uint8_t getIDFromString(const char *);
|
||||
uint8_t nbType();
|
||||
uint8_t GetModel(uint8_t i=0);
|
||||
const char *GetModelString(uint8_t i=0);
|
||||
const char *GetCurrentModelString();
|
||||
const char * GetData();
|
||||
class BMX280SensorDevice : ESP3DSensorDevice {
|
||||
public:
|
||||
BMX280SensorDevice();
|
||||
~BMX280SensorDevice();
|
||||
bool begin();
|
||||
void end();
|
||||
bool isModelValid(uint8_t model);
|
||||
uint8_t getIDFromString(const char *);
|
||||
uint8_t nbType();
|
||||
uint8_t GetModel(uint8_t i = 0);
|
||||
const char *GetModelString(uint8_t i = 0);
|
||||
const char *GetCurrentModelString();
|
||||
const char *GetData();
|
||||
};
|
||||
|
||||
#endif //_BMX280_SENSOR_H
|
||||
|
||||
#endif //_BMX280_SENSOR_H
|
||||
|
@ -18,28 +18,24 @@
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef _DHT_SENSOR_H
|
||||
#define _DHT_SENSOR_H
|
||||
|
||||
#include "sensor.h"
|
||||
|
||||
class DHTSensorDevice : ESP3DSensorDevice
|
||||
{
|
||||
public:
|
||||
DHTSensorDevice();
|
||||
~DHTSensorDevice();
|
||||
bool begin();
|
||||
void end();
|
||||
bool isModelValid(uint8_t model);
|
||||
uint8_t getIDFromString(const char *);
|
||||
uint8_t nbType();
|
||||
uint8_t GetModel(uint8_t i=0);
|
||||
const char *GetModelString(uint8_t i=0);
|
||||
const char *GetCurrentModelString();
|
||||
const char * GetData();
|
||||
class DHTSensorDevice : ESP3DSensorDevice {
|
||||
public:
|
||||
DHTSensorDevice();
|
||||
~DHTSensorDevice();
|
||||
bool begin();
|
||||
void end();
|
||||
bool isModelValid(uint8_t model);
|
||||
uint8_t getIDFromString(const char *);
|
||||
uint8_t nbType();
|
||||
uint8_t GetModel(uint8_t i = 0);
|
||||
const char *GetModelString(uint8_t i = 0);
|
||||
const char *GetCurrentModelString();
|
||||
const char *GetData();
|
||||
};
|
||||
|
||||
#endif //_DHT_SENSOR_H
|
||||
|
||||
#endif //_DHT_SENSOR_H
|
||||
|
@ -18,84 +18,49 @@
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef _ESP3D_SENSOR_H
|
||||
#define _ESP3D_SENSOR_H
|
||||
|
||||
class ESP3DSensorDevice
|
||||
{
|
||||
public:
|
||||
ESP3DSensorDevice() {}
|
||||
virtual ~ESP3DSensorDevice() {}
|
||||
virtual bool begin()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
virtual void end() {}
|
||||
virtual bool isModelValid(uint8_t model)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
virtual uint8_t getIDFromString(const char *)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
virtual uint8_t nbType()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
virtual uint8_t GetModel(uint8_t i=0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
virtual const char *GetCurrentModelString()
|
||||
{
|
||||
return "None";
|
||||
}
|
||||
virtual const char *GetModelString(uint8_t i=0)
|
||||
{
|
||||
return "None";
|
||||
}
|
||||
virtual const char * GetData()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
class ESP3DSensorDevice {
|
||||
public:
|
||||
ESP3DSensorDevice() {}
|
||||
virtual ~ESP3DSensorDevice() {}
|
||||
virtual bool begin() { return false; }
|
||||
virtual void end() {}
|
||||
virtual bool isModelValid(uint8_t model) { return false; }
|
||||
virtual uint8_t getIDFromString(const char *) { return 0; }
|
||||
virtual uint8_t nbType() { return 0; }
|
||||
virtual uint8_t GetModel(uint8_t i = 0) { return 0; }
|
||||
virtual const char *GetCurrentModelString() { return "None"; }
|
||||
virtual const char *GetModelString(uint8_t i = 0) { return "None"; }
|
||||
virtual const char *GetData() { return ""; }
|
||||
};
|
||||
|
||||
class ESP3DSensor
|
||||
{
|
||||
public:
|
||||
ESP3DSensor();
|
||||
~ESP3DSensor();
|
||||
bool begin();
|
||||
void end();
|
||||
void handle();
|
||||
bool setInterval(uint interval);
|
||||
bool isModelValid(uint8_t model);
|
||||
const char * GetCurrentModelString();
|
||||
uint8_t getIDFromString(const char *s);
|
||||
uint8_t nbType();
|
||||
uint interval()
|
||||
{
|
||||
return _interval;
|
||||
}
|
||||
uint8_t GetModel(uint8_t i=0);
|
||||
const char *GetModelString(uint8_t i=0);
|
||||
const char * GetData();
|
||||
bool started()
|
||||
{
|
||||
return _started;
|
||||
}
|
||||
protected:
|
||||
bool _started;
|
||||
uint32_t _interval;
|
||||
uint32_t _lastReadTime;
|
||||
ESP3DSensorDevice * _device;
|
||||
};
|
||||
class ESP3DSensor {
|
||||
public:
|
||||
ESP3DSensor();
|
||||
~ESP3DSensor();
|
||||
bool begin();
|
||||
void end();
|
||||
void handle();
|
||||
bool setInterval(uint interval);
|
||||
bool isModelValid(uint8_t model);
|
||||
const char *GetCurrentModelString();
|
||||
uint8_t getIDFromString(const char *s);
|
||||
uint8_t nbType();
|
||||
uint interval() { return _interval; }
|
||||
uint8_t GetModel(uint8_t i = 0);
|
||||
const char *GetModelString(uint8_t i = 0);
|
||||
const char *GetData();
|
||||
bool started() { return _started; }
|
||||
|
||||
protected:
|
||||
bool _started;
|
||||
uint32_t _interval;
|
||||
uint32_t _lastReadTime;
|
||||
ESP3DSensorDevice *_device;
|
||||
};
|
||||
|
||||
extern ESP3DSensor esp3d_sensor;
|
||||
|
||||
#endif //_ESP3D_SENSOR_H
|
||||
|
||||
#endif //_ESP3D_SENSOR_H
|
||||
|
@ -294,8 +294,10 @@ void ESP3DSerialService::flushbuffer() {
|
||||
// dispatch command
|
||||
if (_started) {
|
||||
ESP3DMessage *message = ESP3DMessageManager::newMsg(
|
||||
_origin, _id== MAIN_SERIAL?ESP3DClientType::all_clients: esp3d_commands.getOutputClient(), (uint8_t *)_buffer, _buffer_size,
|
||||
getAuthentication());
|
||||
_origin,
|
||||
_id == MAIN_SERIAL ? ESP3DClientType::all_clients
|
||||
: esp3d_commands.getOutputClient(),
|
||||
(uint8_t *)_buffer, _buffer_size, getAuthentication());
|
||||
if (message) {
|
||||
// process command
|
||||
message->type = ESP3DMessageType::unique;
|
||||
|
@ -23,8 +23,9 @@
|
||||
|
||||
#if defined(ESP3DLIB_ENV) && COMMUNICATION_PROTOCOL == SOCKET_SERIAL
|
||||
#include <Arduino.h>
|
||||
#include "../../core/esp3d_message.h"
|
||||
|
||||
#include "../../core/esp3d_commands.h"
|
||||
#include "../../core/esp3d_message.h"
|
||||
#include "serial2socket.h"
|
||||
|
||||
Serial_2_Socket Serial2Socket;
|
||||
@ -167,8 +168,8 @@ void Serial_2_Socket::handle_flush() {
|
||||
void Serial_2_Socket::flush(void) {
|
||||
if (_TXbufferSize > 0 && _started && !_paused) {
|
||||
ESP3DMessage *msg = ESP3DMessageManager::newMsg(
|
||||
ESP3DClientType::socket_serial, ESP3DClientType::all_clients,
|
||||
_TXbuffer, _TXbufferSize, _auth);
|
||||
ESP3DClientType::socket_serial, ESP3DClientType::all_clients, _TXbuffer,
|
||||
_TXbufferSize, _auth);
|
||||
// dispatch command
|
||||
if (msg) {
|
||||
// process command
|
||||
@ -186,7 +187,7 @@ void Serial_2_Socket::flush(void) {
|
||||
|
||||
bool Serial_2_Socket::dispatch(ESP3DMessage *message) {
|
||||
if (!message || !_started) {
|
||||
esp3d_log_e("Serial2Socket: no message or not started");
|
||||
esp3d_log_e("Serial2Socket: no message or not started");
|
||||
return false;
|
||||
}
|
||||
if (message->size > 0 && message->data) {
|
||||
|
@ -22,14 +22,13 @@
|
||||
#define _SERIAL_2_SOCKET_H_
|
||||
|
||||
#include <Print.h>
|
||||
|
||||
#include "../authentication/authentication_level_types.h"
|
||||
#define S2S_TXBUFFERSIZE 1200
|
||||
#define S2S_RXBUFFERSIZE 128
|
||||
#define S2S_FLUSHTIMEOUT 500
|
||||
|
||||
|
||||
class ESP3DMessage; // forward declaration
|
||||
|
||||
class ESP3DMessage; // forward declaration
|
||||
|
||||
class Serial_2_Socket : public Stream {
|
||||
public:
|
||||
|
@ -250,7 +250,8 @@ void TimeService::handle() {
|
||||
isSet = true;
|
||||
#if COMMUNICATION_PROTOCOL != MKS_SERIAL
|
||||
#if defined(ESP_GOT_DATE_TIME_HOOK) && defined(GCODE_HOST_FEATURE)
|
||||
String dateMsg = esp3d_string::expandString(ESP_GOT_DATE_TIME_HOOK, true);
|
||||
String dateMsg =
|
||||
esp3d_string::expandString(ESP_GOT_DATE_TIME_HOOK, true);
|
||||
esp3d_gcode_host.processScript(dateMsg.c_str());
|
||||
#endif // #if defined (ESP_GOT_IP_HOOK) && defined (GCODE_HOST_FEATURE)
|
||||
#endif // #if COMMUNICATION_PROTOCOL == MKS_SERIAL
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include <Arduino.h>
|
||||
#include <time.h>
|
||||
|
||||
|
||||
class TimeService {
|
||||
public:
|
||||
TimeService();
|
||||
|
@ -21,26 +21,27 @@
|
||||
#ifndef _ESP_CONFIG_FILE_H
|
||||
#define _ESP_CONFIG_FILE_H
|
||||
#include <Arduino.h>
|
||||
typedef std::function<bool(const char*, const char*,const char*)> TProcessingFunction;
|
||||
typedef std::function<bool(const char *, const char *, const char *)>
|
||||
TProcessingFunction;
|
||||
|
||||
class ESP_ConfigFile
|
||||
{
|
||||
public:
|
||||
ESP_ConfigFile(const char * path, TProcessingFunction fn);
|
||||
~ESP_ConfigFile();
|
||||
char * trimSpaces(char * line, uint8_t maxsize=0);
|
||||
bool isComment(char * line);
|
||||
bool isSection(char * line);
|
||||
bool isValue(char * line);
|
||||
char * getSectionName(char * line);
|
||||
char * getKeyName(char * line);
|
||||
char * getValue(char * line);
|
||||
bool processFile();
|
||||
bool revokeFile();
|
||||
private:
|
||||
bool isScrambleKey(const char *key, const char * str);
|
||||
char * _filename;
|
||||
TProcessingFunction _pfunction;
|
||||
class ESP_ConfigFile {
|
||||
public:
|
||||
ESP_ConfigFile(const char *path, TProcessingFunction fn);
|
||||
~ESP_ConfigFile();
|
||||
char *trimSpaces(char *line, uint8_t maxsize = 0);
|
||||
bool isComment(char *line);
|
||||
bool isSection(char *line);
|
||||
bool isValue(char *line);
|
||||
char *getSectionName(char *line);
|
||||
char *getKeyName(char *line);
|
||||
char *getValue(char *line);
|
||||
bool processFile();
|
||||
bool revokeFile();
|
||||
|
||||
private:
|
||||
bool isScrambleKey(const char *key, const char *str);
|
||||
char *_filename;
|
||||
TProcessingFunction _pfunction;
|
||||
};
|
||||
|
||||
#endif //_ESP_CONFIG_FILE_H
|
||||
#endif //_ESP_CONFIG_FILE_H
|
||||
|
@ -288,7 +288,8 @@ bool processingFileFunction(const char* section, const char* key,
|
||||
b = v;
|
||||
}
|
||||
}
|
||||
// Notification type None / PushOver / Line / Email / Telegram / IFTTT / HomeAssistant
|
||||
// Notification type None / PushOver / Line / Email / Telegram / IFTTT /
|
||||
// HomeAssistant
|
||||
if (!done) {
|
||||
if (strcasecmp("NOTIF_TYPE", key) == 0) {
|
||||
T = 'B';
|
||||
|
@ -21,21 +21,18 @@
|
||||
#ifndef _UPDATE_SERVICES_H
|
||||
#define _UPDATE_SERVICES_H
|
||||
|
||||
class UpdateService {
|
||||
public:
|
||||
UpdateService();
|
||||
~UpdateService();
|
||||
void handle();
|
||||
bool begin();
|
||||
void end();
|
||||
|
||||
class UpdateService
|
||||
{
|
||||
public:
|
||||
UpdateService();
|
||||
~UpdateService();
|
||||
void handle();
|
||||
bool begin();
|
||||
void end();
|
||||
|
||||
private:
|
||||
bool flash(const char * filename, int type);
|
||||
private:
|
||||
bool flash(const char* filename, int type);
|
||||
};
|
||||
|
||||
extern UpdateService update_service;
|
||||
|
||||
#endif //_UPDATE_SERVICES_H
|
||||
|
||||
#endif //_UPDATE_SERVICES_H
|
||||
|
@ -87,15 +87,15 @@ void WebdavServer::handler_copy(const char* url) {
|
||||
}
|
||||
// check available space
|
||||
#if WEBDAV_FEATURE == FS_ROOT
|
||||
uint64_t free_space = WebDavFS::freeBytes(fsTypeDestination);
|
||||
uint64_t free_space = WebDavFS::freeBytes(fsTypeDestination);
|
||||
#else
|
||||
#if WEBDAV_FEATURE == FS_FLASH
|
||||
size_t free_space;
|
||||
size_t free_space;
|
||||
#endif
|
||||
#if WEBDAV_FEATURE == FS_SD
|
||||
uint64_t free_space;
|
||||
uint64_t free_space;
|
||||
#endif
|
||||
free_space = WebDavFS::freeBytes();
|
||||
free_space = WebDavFS::freeBytes();
|
||||
#endif
|
||||
if (overwrite) {
|
||||
if (WebDavFS::exists(destination.c_str())) {
|
||||
|
@ -59,15 +59,15 @@ void WebdavServer::handler_put(const char* url) {
|
||||
if (!hasError) {
|
||||
// check size available
|
||||
#if WEBDAV_FEATURE == FS_ROOT
|
||||
uint64_t free_space = WebDavFS::freeBytes(fsType);
|
||||
uint64_t free_space = WebDavFS::freeBytes(fsType);
|
||||
#else
|
||||
#if WEBDAV_FEATURE == FS_FLASH
|
||||
size_t free_space;
|
||||
size_t free_space;
|
||||
#endif
|
||||
#if WEBDAV_FEATURE == FS_SD
|
||||
uint64_t free_space;
|
||||
uint64_t free_space;
|
||||
#endif
|
||||
free_space = WebDavFS::freeBytes();
|
||||
free_space = WebDavFS::freeBytes();
|
||||
#endif
|
||||
if (free_space + file.size() < content_length) {
|
||||
code = 507;
|
||||
@ -90,15 +90,15 @@ void WebdavServer::handler_put(const char* url) {
|
||||
} else {
|
||||
// check size available
|
||||
#if WEBDAV_FEATURE == FS_ROOT
|
||||
uint64_t free_space = WebDavFS::freeBytes(fsType);
|
||||
uint64_t free_space = WebDavFS::freeBytes(fsType);
|
||||
#else
|
||||
#if WEBDAV_FEATURE == FS_FLASH
|
||||
size_t free_space;
|
||||
size_t free_space;
|
||||
#endif
|
||||
#if WEBDAV_FEATURE == FS_SD
|
||||
uint64_t free_space;
|
||||
uint64_t free_space;
|
||||
#endif
|
||||
free_space = WebDavFS::freeBytes();
|
||||
free_space = WebDavFS::freeBytes();
|
||||
#endif
|
||||
if (free_space < content_length) {
|
||||
code = 507;
|
||||
|
@ -78,7 +78,7 @@ bool WebSocket_Server::pushMSG(uint num, const char *data) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool WebSocket_Server::isConnected(){
|
||||
bool WebSocket_Server::isConnected() {
|
||||
if (_websocket_server) {
|
||||
return _websocket_server->connectedClients() > 0;
|
||||
}
|
||||
@ -268,7 +268,7 @@ size_t WebSocket_Server::writeBytes(const uint8_t *buffer, size_t size) {
|
||||
}
|
||||
// need periodic check to force to flush in case of no end
|
||||
for (uint i = 0; i < size; i++) {
|
||||
//add a sanity check to avoid buffer overflow
|
||||
// add a sanity check to avoid buffer overflow
|
||||
if (_TXbufferSize >= TXBUFFERSIZE) {
|
||||
flushTXbuffer();
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ bool WiFiConfig::StartSTA() {
|
||||
WiFi.setMinSecurity(WIFI_AUTH_WEP);
|
||||
WiFi.setScanMethod(WIFI_ALL_CHANNEL_SCAN);
|
||||
WiFi.setSortMethod(WIFI_CONNECT_AP_BY_SIGNAL);
|
||||
#if defined(ESP32_WIFI_TX_POWER)
|
||||
#if defined(ESP32_WIFI_TX_POWER)
|
||||
WiFi.setTxPower(ESP32_WIFI_TX_POWER);
|
||||
delay(100);
|
||||
#endif // ESP32_WIFI_TX_POWER
|
||||
@ -232,10 +232,10 @@ bool WiFiConfig::StartAP(bool setupMode) {
|
||||
_ap_gateway = setupMode ? ip : gw;
|
||||
_ap_subnet = mask;
|
||||
#endif // ARDUINO_ARCH_ESP8266
|
||||
#if defined(ESP32_WIFI_TX_POWER) && defined(ARDUINO_ARCH_ESP32)
|
||||
#if defined(ESP32_WIFI_TX_POWER) && defined(ARDUINO_ARCH_ESP32)
|
||||
WiFi.setTxPower(ESP32_WIFI_TX_POWER);
|
||||
delay(100);
|
||||
#endif // ESP32_WIFI_TX_POWER
|
||||
#endif // ESP32_WIFI_TX_POWER
|
||||
|
||||
// Start AP
|
||||
if (WiFi.softAP(SSID.c_str(),
|
||||
|
32
tools/format_sources.py
Normal file
32
tools/format_sources.py
Normal file
@ -0,0 +1,32 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
# Base directory of the script
|
||||
script_path = os.path.abspath(__file__)
|
||||
|
||||
# Extract dir path
|
||||
script_dir = os.path.dirname(script_path)
|
||||
|
||||
# Build path of sources dir : ../esp3d
|
||||
base_dir = os.path.abspath(os.path.normpath(os.path.join(script_dir, '..', 'esp3d')))
|
||||
|
||||
# Parse all c, h , cpp files in all directories and sub directories
|
||||
file_paths = []
|
||||
for root, dirs, files in os.walk(base_dir):
|
||||
for file in files:
|
||||
if file.endswith(('.c', '.cpp', '.h', '.ino')):
|
||||
file_path = os.path.join(root, file)
|
||||
file_paths.append(os.path.abspath(os.path.normpath(file_path)))
|
||||
|
||||
# Now format all files one by one with clang-format
|
||||
for file_path in file_paths:
|
||||
tmpPath = '"' + file_path + '"'
|
||||
print("Formating " + tmpPath, end="")
|
||||
try:
|
||||
command = ['clang-format', '-i', '--style=Google', file_path]
|
||||
subprocess.run(command, check=False)
|
||||
print("=> Ok")
|
||||
except subprocess.CalledProcessError as e:
|
||||
print(f'=>Error : {e}')
|
Loading…
x
Reference in New Issue
Block a user