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:
Luc 2024-05-29 15:10:47 +08:00
parent 9a597ca940
commit ea1eb83a28
83 changed files with 4358 additions and 4029 deletions

28
embedded/.prettierrc Normal file
View 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"
}
}
]
}

View File

@ -1,95 +1,94 @@
let path = require("path"); let path = require('path');
const fs = require("fs"); const fs = require('fs');
const { createReadStream, createWriteStream } = require("fs"); const { createReadStream, createWriteStream } = require('fs');
const { createGzip } = require("zlib"); const { createGzip } = require('zlib');
const chalk = require("chalk"); const chalk = require('chalk');
let distPath = path.normalize(__dirname + "/../dist/"); let distPath = path.normalize(__dirname + '/../dist/');
let srcPath = path.normalize(__dirname + "/../assets/"); let srcPath = path.normalize(__dirname + '/../assets/');
let headerPath = path.normalize( let headerPath = path.normalize(
__dirname + "/../../esp3d/src/modules/http/favicon.h" __dirname + '/../../esp3d/src/modules/http/favicon.h'
); );
const convertToC = (filepath) => { const convertToC = (filepath) => {
console.log(chalk.yellow("Converting bin to text file")); console.log(chalk.yellow('Converting bin to text file'));
//Cleaning files //Cleaning files
if (fs.existsSync(distPath + "out.tmp")) fs.rmSync(distPath + "out.tmp"); if (fs.existsSync(distPath + 'out.tmp')) fs.rmSync(distPath + 'out.tmp');
if (fs.existsSync(distPath + "favicon.h")) fs.rmSync(distPath + "favicon.h"); if (fs.existsSync(distPath + 'favicon.h'))
fs.rmSync(distPath + 'favicon.h');
const data = new Uint8Array( const data = new Uint8Array(fs.readFileSync(filepath, { flag: 'r' }));
fs.readFileSync(filepath, { flag: "r" }) console.log('data size is ', data.length);
); let out = '#define favicon_size ' + data.length + '\n';
console.log("data size is ", data.length); out += 'const unsigned char favicon[' + data.length + '] PROGMEM = {\n ';
let out = "#define favicon_size " + data.length + "\n"; let nb = 0;
out += "const unsigned char favicon[" + data.length + "] PROGMEM = {\n "; data.forEach((byte, index) => {
let nb = 0; out +=
data.forEach((byte, index) => { ' 0x' +
out += " 0x" + (byte.toString(16).length == 1 ? "0" : "") + byte.toString(16); (byte.toString(16).length == 1 ? '0' : '') +
if (index < data.length - 1) out += ","; byte.toString(16);
if (nb == 15) { if (index < data.length - 1) out += ',';
out += "\n "; if (nb == 15) {
nb = 0; out += '\n ';
} else { nb = 0;
nb++; } else {
} nb++;
}); }
});
out += "\n};\n"; out += '\n};\n';
fs.writeFileSync(distPath + "out.tmp", out); fs.writeFileSync(distPath + 'out.tmp', out);
//Check conversion //Check conversion
if (fs.existsSync(distPath + "out.tmp")) { if (fs.existsSync(distPath + 'out.tmp')) {
console.log(chalk.green("[ok]")); console.log(chalk.green('[ok]'));
} else { } else {
console.log(chalk.red("[error]Conversion failed")); console.log(chalk.red('[error]Conversion failed'));
return; return;
} }
//Format header file //Format header file
console.log(chalk.yellow("Building header")); console.log(chalk.yellow('Building header'));
fs.writeFileSync( fs.writeFileSync(
distPath + "favicon.h", distPath + 'favicon.h',
fs.readFileSync(srcPath + "header.txt") 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)}
); );
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');

View File

@ -1,75 +1,76 @@
let path = require("path"); let path = require('path');
const fs = require("fs"); const fs = require('fs');
const child_process = require("child_process"); const child_process = require('child_process');
const chalk = require("chalk"); const chalk = require('chalk');
let distPath = path.normalize(__dirname + "/../dist/"); let distPath = path.normalize(__dirname + '/../dist/');
let srcPath = path.normalize(__dirname + "/../src/"); let srcPath = path.normalize(__dirname + '/../src/');
let headerPath = path.normalize( 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 //Cleaning files
if (fs.existsSync(distPath + "out.tmp")) fs.rmSync(distPath + "out.tmp"); 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 + 'embedded.h')) fs.rmSync(distPath + 'embedded.h');
const data = new Uint8Array( 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); console.log('data size is ', data.length);
let out = "#define tool_html_gz_size " + data.length + "\n"; let out = '#define tool_html_gz_size ' + data.length + '\n';
out += "const unsigned char tool_html_gz[" + data.length + "] PROGMEM = {\n "; out += 'const unsigned char tool_html_gz[' + data.length + '] PROGMEM = {\n ';
let nb = 0; let nb = 0;
data.forEach((byte, index) => { data.forEach((byte, index) => {
out += " 0x" + (byte.toString(16).length == 1 ? "0" : "") + byte.toString(16); out +=
if (index < data.length - 1) out += ","; ' 0x' + (byte.toString(16).length == 1 ? '0' : '') + byte.toString(16);
if (nb == 15) { if (index < data.length - 1) out += ',';
out += "\n "; if (nb == 15) {
nb = 0; out += '\n ';
} else { nb = 0;
nb++; } else {
} nb++;
}
}); });
out += "\n};\n"; out += '\n};\n';
fs.writeFileSync(distPath + "out.tmp", out); fs.writeFileSync(distPath + 'out.tmp', out);
//Check conversion //Check conversion
if (fs.existsSync(distPath + "out.tmp")) { if (fs.existsSync(distPath + 'out.tmp')) {
console.log(chalk.green("[ok]")); console.log(chalk.green('[ok]'));
} else { } else {
console.log(chalk.red("[error]Conversion failed")); console.log(chalk.red('[error]Conversion failed'));
return; return;
} }
//Format header file //Format header file
console.log(chalk.yellow("Building header")); console.log(chalk.yellow('Building header'));
fs.writeFileSync( fs.writeFileSync(
distPath + "embedded.h", distPath + 'embedded.h',
fs.readFileSync(srcPath + "header.txt") fs.readFileSync(srcPath + 'header.txt')
); );
let bin2cfile = fs.readFileSync(distPath + "out.tmp").toString(); let bin2cfile = fs.readFileSync(distPath + 'out.tmp').toString();
fs.appendFileSync(distPath + "embedded.h", bin2cfile); fs.appendFileSync(distPath + 'embedded.h', bin2cfile);
fs.appendFileSync( fs.appendFileSync(
distPath + "embedded.h", distPath + 'embedded.h',
fs.readFileSync(srcPath + "footer.txt") fs.readFileSync(srcPath + 'footer.txt')
); );
//Check format result //Check format result
if (fs.existsSync(distPath + "embedded.h")) { if (fs.existsSync(distPath + 'embedded.h')) {
console.log(chalk.green("[ok]")); console.log(chalk.green('[ok]'));
} else { } else {
console.log(chalk.red("[error]Conversion failed")); console.log(chalk.red('[error]Conversion failed'));
return; return;
} }
//Move file to src //Move file to src
console.log(chalk.yellow("Overwriting header in sources")); console.log(chalk.yellow('Overwriting header in sources'));
fs.writeFileSync(headerPath, fs.readFileSync(distPath + "embedded.h")); fs.writeFileSync(headerPath, fs.readFileSync(distPath + 'embedded.h'));
if (fs.existsSync(headerPath)) { if (fs.existsSync(headerPath)) {
console.log(chalk.green("[ok]")); console.log(chalk.green('[ok]'));
} else { } else {
console.log(chalk.red("[error]Overwriting failed")); console.log(chalk.red('[error]Overwriting failed'));
return; return;
} }

View File

@ -1,15 +1,16 @@
const path = require("path"); const path = require('path');
const { createReadStream, createWriteStream } = require("fs"); const { createReadStream, createWriteStream } = require('fs');
const { createGzip } = require("zlib"); const { createGzip } = require('zlib');
const faviconPath = path.normalize(__dirname + "/../assets/favicon.ico"); const faviconPath = path.normalize(__dirname + '/../assets/favicon.ico');
// Create a gzip function for reusable purpose // Create a gzip function for reusable purpose
const compressFile = (filePath) => { const compressFile = (filePath) => {
const stream = createReadStream(filePath); const stream = createReadStream(filePath);
stream stream
.pipe(createGzip()) .pipe(createGzip())
.pipe(createWriteStream(`${filePath}.gz`)) .pipe(createWriteStream(`${filePath}.gz`))
.on("finish", () =>console.log(`Successfully compressed the file at ${filePath}`) .on('finish', () =>
); console.log(`Successfully compressed the file at ${filePath}`)
);
}; };
compressFile(faviconPath); compressFile(faviconPath);

File diff suppressed because it is too large Load Diff

View File

@ -1,53 +1,53 @@
const path = require("path"); const path = require('path');
const HtmlWebpackPlugin = require("html-webpack-plugin"); const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = { module.exports = {
mode: "development", // this will trigger some webpack default stuffs for dev 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 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: { output: {
filename: "[name].bundle.js", // [name] will take whatever the input filename is. defaults to 'main' if only a single entry value 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' 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"),
}, },
port: 8088, devServer: {
proxy: { historyApiFallback: true, // to make our SPA works after a full reload, so that it serves 'index.html' when 404 response
context: () => true, open: true,
target: "http://localhost:8080", static: {
}, directory: path.resolve(__dirname, './dist'),
},
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"],
},
}, },
}, port: 8088,
{ proxy: {
test: /\.css$/, // run the loaders below only on .css files context: () => true,
// this are the loaders. they interpret files, in this case css. they run from right to left sequence. target: 'http://localhost:8080',
// 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"], 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'],
},
],
},
}; };

View File

@ -1,93 +1,93 @@
const path = require("path"); const path = require('path');
const MiniCssExtractPlugin = require("mini-css-extract-plugin"); const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const { CleanWebpackPlugin } = require("clean-webpack-plugin"); const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const HtmlWebpackPlugin = require("html-webpack-plugin"); const HtmlWebpackPlugin = require('html-webpack-plugin');
const HtmlMinimizerPlugin = require("html-minimizer-webpack-plugin"); const HtmlMinimizerPlugin = require('html-minimizer-webpack-plugin');
const HtmlInlineScriptPlugin = require("html-inline-script-webpack-plugin"); const HtmlInlineScriptPlugin = require('html-inline-script-webpack-plugin');
const HTMLInlineCSSWebpackPlugin = require("html-inline-css-webpack-plugin") const HTMLInlineCSSWebpackPlugin =
.default; require('html-inline-css-webpack-plugin').default;
const Compression = require("compression-webpack-plugin"); const Compression = require('compression-webpack-plugin');
module.exports = { module.exports = {
mode: "production", // this trigger webpack out-of-box prod optimizations mode: 'production', // this trigger webpack out-of-box prod optimizations
entry: path.resolve(__dirname, "../src/index.js"), entry: path.resolve(__dirname, '../src/index.js'),
output: { output: {
filename: `[name].[hash].js`, // [hash] is useful for cache busting! filename: `[name].[hash].js`, // [hash] is useful for cache busting!
path: path.resolve(__dirname, "../dist"), path: path.resolve(__dirname, '../dist'),
}, },
module: { module: {
rules: [ rules: [
{ {
test: /\.css$/, test: /\.css$/,
use: [MiniCssExtractPlugin.loader, "css-loader"], use: [MiniCssExtractPlugin.loader, 'css-loader'],
}, },
{ {
test: /\.js$/, test: /\.js$/,
exclude: /node_modules/, exclude: /node_modules/,
use: [ use: [
{ {
loader: "babel-loader", loader: 'babel-loader',
options: { options: {
presets: [ presets: [
[ [
"@babel/preset-env", '@babel/preset-env',
{ {
useBuiltIns: "usage", useBuiltIns: 'usage',
debug: false, debug: false,
corejs: 3, corejs: 3,
targets: {"chrome": "88"}, targets: { chrome: '88' },
}, },
], ],
], ],
},
},
],
}, },
},
], ],
}, },
], plugins: [
}, // always deletes the dist folder first in each build run.
plugins: [ new CleanWebpackPlugin(),
// always deletes the dist folder first in each build run. new MiniCssExtractPlugin({
new CleanWebpackPlugin(), filename: '[name].css',
new MiniCssExtractPlugin({ chunkFilename: '[id].css',
filename: "[name].css", }),
chunkFilename: "[id].css", new HtmlWebpackPlugin({
}), template: path.join(__dirname, '../src/index.html'),
new HtmlWebpackPlugin({ inlineSource: '.(js|css)$',
template: path.join(__dirname, "../src/index.html"), inject: 'body',
inlineSource: ".(js|css)$", }),
inject: "body",
}),
new HtmlInlineScriptPlugin({ new HtmlInlineScriptPlugin({
scriptMatchPattern: [/.+[.]js$/], scriptMatchPattern: [/.+[.]js$/],
htmlMatchPattern: [/index.html$/], htmlMatchPattern: [/index.html$/],
}), }),
new HTMLInlineCSSWebpackPlugin(), new HTMLInlineCSSWebpackPlugin(),
new Compression({ new Compression({
test: /\.(html)$/, test: /\.(html)$/,
filename: "[path][base].gz", filename: '[path][base].gz',
algorithm: "gzip", algorithm: 'gzip',
exclude: /.map$/, exclude: /.map$/,
deleteOriginalAssets: "keep-source-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);
},
}),
], ],
}, optimization: {
devtool: "source-map", // supposedly the ideal type without bloating bundle size 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

View File

@ -1,15 +1,18 @@
function initMenus() { function initMenus() {
document.getElementById("FWLink").addEventListener("click", function () { document.getElementById('FWLink').addEventListener('click', function () {
window.open("https://github.com/luc-github/ESP3D/tree/3.0", "_blank"); window.open('https://github.com/luc-github/ESP3D/tree/3.0', '_blank');
}); });
document.getElementById("UiLink").addEventListener("click", function () { document.getElementById('UiLink').addEventListener('click', function () {
window.open("https://github.com/luc-github/ESP3D-WEBUI/tree/3.0", "_blank"); window.open(
}); 'https://github.com/luc-github/ESP3D-WEBUI/tree/3.0',
'_blank'
);
});
document.getElementById("hlpLink").addEventListener("click", function () { document.getElementById('hlpLink').addEventListener('click', function () {
window.open("https://github.com/luc-github/ESP3D/wiki", "_blank"); window.open('https://github.com/luc-github/ESP3D/wiki', '_blank');
}); });
} }
export { initMenus }; export { initMenus };

View File

@ -1,368 +1,368 @@
* { * {
font-family: sans-serif; font-family: sans-serif;
color: #5755d9; color: #5755d9;
background-color: #eef0f3; background-color: #eef0f3;
-webkit-user-select: none; /* Chrome all / Safari all */ -webkit-user-select: none; /* Chrome all / Safari all */
-moz-user-select: none; /* Firefox all */ -moz-user-select: none; /* Firefox all */
-ms-user-select: none; /* IE 10+ */ -ms-user-select: none; /* IE 10+ */
user-select: none; user-select: none;
} }
body { body {
min-width: 360px; min-width: 360px;
} }
hr { hr {
border-top: 1px solid #5755d9; border-top: 1px solid #5755d9;
} }
.controlBar { .controlBar {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
padding: 10px; padding: 10px;
padding-left: 15px; padding-left: 15px;
background-color: white; background-color: white;
margin-bottom: 6px; margin-bottom: 6px;
} }
.cmd { .cmd {
color: #555555; color: #555555;
} }
label { label {
display: block; display: block;
width: auto; width: auto;
padding: 3px 12px; padding: 3px 12px;
color: #5755d9; color: #5755d9;
background-color: #ffffff; background-color: #ffffff;
cursor: pointer; cursor: pointer;
} }
pre { pre {
padding-left: 5px; padding-left: 5px;
padding-right: 5px; padding-right: 5px;
} }
.modal { .modal {
position: fixed; /* Stay in place */ position: fixed; /* Stay in place */
z-index: 10000; /* Sit on top */ z-index: 10000; /* Sit on top */
padding-top: 100px; /* Location of the box */ padding-top: 100px; /* Location of the box */
left: 0; left: 0;
top: 0; top: 0;
width: 100%; /* Full width */ width: 100%; /* Full width */
height: 100%; /* Full height */ height: 100%; /* Full height */
overflow: auto; /* Enable scroll if needed */ overflow: auto; /* Enable scroll if needed */
background-color: rgb(0, 0, 0); /* Fallback color */ background-color: rgb(0, 0, 0); /* Fallback color */
background-color: rgba(0, 0, 0, 0.4); /* Black w/ opacity */ background-color: rgba(0, 0, 0, 0.4); /* Black w/ opacity */
} }
/* Modal Content */ /* Modal Content */
.modal-content { .modal-content {
border-top-left-radius: 10px; border-top-left-radius: 10px;
border-top-right-radius: 10px; border-top-right-radius: 10px;
border-bottom-left-radius: 10px; border-bottom-left-radius: 10px;
border-bottom-right-radius: 10px; border-bottom-right-radius: 10px;
background-color: #5755d9; background-color: #5755d9;
border: 1px solid #5755d9; border: 1px solid #5755d9;
position: relative; position: relative;
margin: auto; margin: auto;
padding: 0; padding: 0;
max-width: 450px; max-width: 450px;
} }
.modal-header { .modal-header {
padding: 16px 16px; padding: 16px 16px;
color: #ffffff; color: #ffffff;
background-color: #5755d9; background-color: #5755d9;
border-top-left-radius: 10px; border-top-left-radius: 10px;
border-top-right-radius: 10px; border-top-right-radius: 10px;
border-bottom: 1px solid #5755d9; border-bottom: 1px solid #5755d9;
height: 2.5rem; height: 2.5rem;
line-height: 2.5rem; line-height: 2.5rem;
font-size: 1.5rem; font-size: 1.5rem;
} }
.modal-body { .modal-body {
padding: 10px 16px; padding: 10px 16px;
background-color: #ffffff; background-color: #ffffff;
} }
.modal-footer { .modal-footer {
padding: 16px 16px; padding: 16px 16px;
height: 2.5em; height: 2.5em;
background-color: #ffffff; background-color: #ffffff;
border-top: 1px solid #5755d9; border-top: 1px solid #5755d9;
border-bottom-left-radius: 10px; border-bottom-left-radius: 10px;
border-bottom-right-radius: 10px; border-bottom-right-radius: 10px;
display: flex; display: flex;
flex-direction: row-reverse; flex-direction: row-reverse;
} }
input { input {
display: block; display: block;
width: auto; width: auto;
height: 1.5rem; height: 1.5rem;
padding: 6px 12px; padding: 6px 12px;
line-height: 1.42857143; line-height: 1.42857143;
border-radius: 4px; border-radius: 4px;
color: #5755d9; color: #5755d9;
background-color: #ffffff; background-color: #ffffff;
outline: 0; outline: 0;
} }
input { input {
border: 1px solid #5755d9; border: 1px solid #5755d9;
} }
button { button {
display: block; display: block;
width: auto; width: auto;
height: 2.4rem; height: 2.4rem;
padding: 6px 12px; padding: 6px 12px;
line-height: 1.42857143; line-height: 1.42857143;
vertical-align: middle; vertical-align: middle;
cursor: pointer; cursor: pointer;
border: 1px solid black; border: 1px solid black;
white-space: nowrap; white-space: nowrap;
border-radius: 4px; border-radius: 4px;
color: #ffffff; color: #ffffff;
background-color: #5755d9; background-color: #5755d9;
} }
::-moz-progress-bar { ::-moz-progress-bar {
background-color: #5755d9; background-color: #5755d9;
} }
::-webkit-progress-value { ::-webkit-progress-value {
background-color: #5755d9; background-color: #5755d9;
} }
::-webkit-progress-bar { ::-webkit-progress-bar {
background-color: #f1f1f1; background-color: #f1f1f1;
} }
progress, progress,
.progbar { .progbar {
margin-top: 10px; margin-top: 10px;
height: 1rem; height: 1rem;
background-color: #f1f1f1; background-color: #f1f1f1;
border: 1px solid #5755d9; border: 1px solid #5755d9;
} }
.label { .label {
height: 2.4rem; height: 2.4rem;
padding: 6px 12px; padding: 6px 12px;
line-height: 1.42857143; line-height: 1.42857143;
vertical-align: middle; vertical-align: middle;
display: inline-block; display: inline-block;
width: auto; width: auto;
color: #5755d9; color: #5755d9;
background-color: #ffffff; background-color: #ffffff;
overflow-wrap: anywhere; overflow-wrap: anywhere;
} }
.controlBar > button { .controlBar > button {
margin-right: 15px; margin-right: 15px;
} }
meter { meter {
background-color: #ffffff; background-color: #ffffff;
} }
button:active { button:active {
background-color: #0b0899; background-color: #0b0899;
} }
ul { ul {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
list-style-type: none; list-style-type: none;
margin: 3px; margin: 3px;
padding: 3px; padding: 3px;
} }
pre { pre {
margin: 10px 10px; margin: 10px 10px;
min-height: 350px; min-height: 350px;
max-height: 350px; max-height: 350px;
border: 1px solid #5755d9; border: 1px solid #5755d9;
overflow-y: auto; overflow-y: auto;
overflow-wrap: anywhere; overflow-wrap: anywhere;
} }
li { li {
padding: 9px 14px; padding: 9px 14px;
margin: 0px 1rem; margin: 0px 1rem;
border: 1px hidden; border: 1px hidden;
} }
.menuspacer { .menuspacer {
flex-grow: 1; flex-grow: 1;
pointer-events: none; pointer-events: none;
} }
.panel { .panel {
margin: 10px 10px; margin: 10px 10px;
border-radius: 10px; border-radius: 10px;
} }
.text-primary { .text-primary {
color: #5755d9; color: #5755d9;
} }
.text-error { .text-error {
color: red; color: red;
} }
.text-error-login { .text-error-login {
background-color: white; background-color: white;
color: red; color: red;
text-align: center; text-align: center;
} }
.disabled { .disabled {
pointer-events: none; pointer-events: none;
} }
.panel-header { .panel-header {
border-top-left-radius: 10px; border-top-left-radius: 10px;
border-top-right-radius: 10px; border-top-right-radius: 10px;
background-color: #5755d9; background-color: #5755d9;
color: white; color: white;
height: 2rem; height: 2rem;
line-height: 2rem; line-height: 2rem;
padding: 2px 15px; padding: 2px 15px;
cursor: pointer; cursor: pointer;
} }
.no-header { .no-header {
border-top-left-radius: 10px; border-top-left-radius: 10px;
border-top-right-radius: 10px; border-top-right-radius: 10px;
border-top: 1px solid #5755d9; border-top: 1px solid #5755d9;
} }
.no-footer { .no-footer {
border-bottom-left-radius: 10px; border-bottom-left-radius: 10px;
border-bottom-right-radius: 10px; border-bottom-right-radius: 10px;
border-bottom: 1px solid #5755d9; border-bottom: 1px solid #5755d9;
} }
.panel-footer { .panel-footer {
border-bottom-left-radius: 10px; border-bottom-left-radius: 10px;
border-bottom-right-radius: 10px; border-bottom-right-radius: 10px;
border: 1px solid #5755d9; border: 1px solid #5755d9;
background-color: white; background-color: white;
min-height: 2rem; min-height: 2rem;
line-height: 2rem; line-height: 2rem;
padding: 2px 15px; padding: 2px 15px;
margin: 0px 0px; margin: 0px 0px;
display: -ms-flexbox; display: -ms-flexbox;
display: flex; display: flex;
-ms-flex-wrap: wrap; -ms-flex-wrap: wrap;
flex-wrap: wrap; flex-wrap: wrap;
} }
.panel-footer span { .panel-footer span {
background-color: white; background-color: white;
} }
.panel-body { .panel-body {
min-height: 50px; min-height: 50px;
background-color: white; background-color: white;
border-right: 1px solid #5755d9; border-right: 1px solid #5755d9;
border-left: 1px solid #5755d9; border-left: 1px solid #5755d9;
} }
.no-header { .no-header {
padding: 10px 10px; padding: 10px 10px;
} }
.hide { .hide {
display: none; display: none;
} }
.filesize, .filesize,
.filetype, .filetype,
.fileitem, .fileitem,
.fileicon { .fileicon {
padding: 5px 5px; padding: 5px 5px;
border-radius: 5px 5px; border-radius: 5px 5px;
background-color: white; background-color: white;
} }
.fileLineTail { .fileLineTail {
background-color: white; background-color: white;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
column-gap: 10px; column-gap: 10px;
} }
.fileLineHead { .fileLineHead {
background-color: white; background-color: white;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
column-gap: 10px; column-gap: 10px;
} }
.fileLine { .fileLine {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
line-height: 1.42857143; line-height: 1.42857143;
vertical-align: center; vertical-align: center;
border-top: 1px solid #5755d9; border-top: 1px solid #5755d9;
background-color: white; background-color: white;
padding: 8px; padding: 8px;
} }
svg { svg {
background-color: white; background-color: white;
} }
.fileicon:hover { .fileicon:hover {
cursor: pointer; cursor: pointer;
background-color: #5755d9; background-color: #5755d9;
color: #5755d9; color: #5755d9;
} }
.fileitem:hover, .fileitem:hover,
li:active, li:active,
li:hover { li:hover {
cursor: pointer; cursor: pointer;
background-color: #5755d9; background-color: #5755d9;
color: white; color: white;
text-align: center; text-align: center;
} }
.fileitem:active { .fileitem:active {
background-color: #0b0899; background-color: #0b0899;
} }
.fileicon:hover > svg { .fileicon:hover > svg {
cursor: pointer; cursor: pointer;
background-color: #5755d9; background-color: #5755d9;
color: #5755d9; color: #5755d9;
} }
.m-1{ .m-1 {
margin-left: 1rem; margin-left: 1rem;
margin-right: 1rem; margin-right: 1rem;
} }
button > svg { button > svg {
background-color: #5755d9; background-color: #5755d9;
text-decoration-color: #ffffff; text-decoration-color: #ffffff;
color: white !important; color: white !important;
} }
button:active > svg, button:active > svg,
.fileicon:active > svg, .fileicon:active > svg,
.fileicon:active { .fileicon:active {
background-color: #0b0899; background-color: #0b0899;
} }
#MSG { #MSG {
text-align: center; text-align: center;
} }
#monitor_enable_autoscroll { #monitor_enable_autoscroll {
margin: 0px 0px; margin: 0px 0px;
cursor: pointer; cursor: pointer;
} }
@media screen and (max-width: 600px) { @media screen and (max-width: 600px) {
.menuspacer { .menuspacer {
display: none; display: none;
} }
} }

View 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()

View File

@ -37,17 +37,17 @@
#endif #endif
/************************************ /************************************
* *
* ESP32 C3 -patch * ESP32 C3 -patch
* *
* Uncomment only if your ESP32 C3 board cannot start * Uncomment only if your ESP32 C3 board cannot start
* *
************************************/ ************************************/
//Possible values // Possible values
//WIFI_POWER_5dBm // WIFI_POWER_5dBm
//WIFI_POWER_8_5dBm // WIFI_POWER_8_5dBm
//WIFI_POWER_15dBm // 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 /* Enable authentication
* Force usage of authentication for commands * Force usage of authentication for commands
*/ */
//#define AUTHENTICATION_FEATURE // #define AUTHENTICATION_FEATURE
/************************************ /************************************
* *
@ -576,13 +576,13 @@
/* Hook when got IP /* Hook when got IP
* Commands to run on event * Commands to run on event
* Separate commands with ';' * Separate commands with ';'
*/ */
#define ESP_GOT_IP_HOOK "[ESP212]IP:%ESP_IP%" #define ESP_GOT_IP_HOOK "[ESP212]IP:%ESP_IP%"
/* Hook when got date time /* Hook when got date time
* Commands to run on event * Commands to run on event
* Separate commands with ';' * Separate commands with ';'
*/ */
#define ESP_GOT_DATE_TIME_HOOK "[ESP212]DATE:%ESP_DATETIME%" #define ESP_GOT_DATE_TIME_HOOK "[ESP212]DATE:%ESP_DATETIME%"
@ -617,10 +617,9 @@
// LOG_OUTPUT_SERIAL2 // LOG_OUTPUT_SERIAL2
// LOG_OUTPUT_TELNET // LOG_OUTPUT_TELNET
// LOG_OUTPUT_WEBSOCKET // LOG_OUTPUT_WEBSOCKET
//#define ESP_LOG_FEATURE LOG_OUTPUT_SERIAL0 // #define ESP_LOG_FEATURE LOG_OUTPUT_SERIAL0
//#define ESP3D_DEBUG_LEVEL LOG_LEVEL_DEBUG
// #define ESP3D_DEBUG_LEVEL LOG_LEVEL_DEBUG
#ifdef ESP_LOG_FEATURE #ifdef ESP_LOG_FEATURE
#define LOG_ESP3D_BAUDRATE 115200 #define LOG_ESP3D_BAUDRATE 115200
@ -639,7 +638,8 @@
* Do not modify * 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 #define TIMESTAMP_FEATURE
#endif // SD_TIMESTAMP_FEATURE || FILESYSTEM_TIMESTAMP_FEATURE #endif // SD_TIMESTAMP_FEATURE || FILESYSTEM_TIMESTAMP_FEATURE

View File

@ -19,17 +19,11 @@
*/ */
#include "src/core/esp3d.h" #include "src/core/esp3d.h"
//global variable // global variable
Esp3D myesp3d; Esp3D myesp3d;
//Setup // Setup
void setup() void setup() { myesp3d.begin(); }
{
myesp3d.begin();
}
//main loop // main loop
void loop() void loop() { myesp3d.handle(); }
{
myesp3d.handle();
}

View File

@ -138,7 +138,8 @@ const char* help[] = {
#endif // AUTHENTICATION_FEATURE #endif // AUTHENTICATION_FEATURE
#if defined(NOTIFICATION_FEATURE) #if defined(NOTIFICATION_FEATURE)
"[ESP600](message) - send notification", "[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", "(TS=xxx) - display/set Notification settings",
"[ESP620]URL=http://XXXXXX - send GET notification", "[ESP620]URL=http://XXXXXX - send GET notification",
#endif // NOTIFICATION_FEATURE #endif // NOTIFICATION_FEATURE

View File

@ -63,7 +63,7 @@ void ESP3DCommands::ESP170(int cmd_params_pos, ESP3DMessage* msg) {
"light", "light",
#endif // CAM_LED_PIN #endif // CAM_LED_PIN
}; };
bool hasError = false; bool hasError = false;
String ok_msg; String ok_msg;
String error_msg; String error_msg;
ESP3DClientType target = msg->origin; ESP3DClientType target = msg->origin;
@ -125,8 +125,9 @@ void ESP3DCommands::ESP170(int cmd_params_pos, ESP3DMessage* msg) {
} }
// contrast // contrast
if (!dispatchIdValue(json, "contrast", String(s->status.contrast).c_str(), if (!dispatchIdValue(json, "contrast",
target, requestId)) { String(s->status.contrast).c_str(), target,
requestId)) {
return; return;
} }
@ -151,14 +152,15 @@ void ESP3DCommands::ESP170(int cmd_params_pos, ESP3DMessage* msg) {
} }
// wb_mode // wb_mode
if (!dispatchIdValue(json, "wb_mode", String(s->status.wb_mode).c_str(), if (!dispatchIdValue(json, "wb_mode",
target, requestId)) { String(s->status.wb_mode).c_str(), target,
requestId)) {
return; return;
} }
// awb // awb
if (!dispatchIdValue(json, "awb", String(s->status.awb).c_str(), target, if (!dispatchIdValue(json, "awb", String(s->status.awb).c_str(),
requestId)) { target, requestId)) {
return; return;
} }
@ -170,8 +172,8 @@ void ESP3DCommands::ESP170(int cmd_params_pos, ESP3DMessage* msg) {
} }
// aec // aec
if (!dispatchIdValue(json, "aec", String(s->status.aec).c_str(), target, if (!dispatchIdValue(json, "aec", String(s->status.aec).c_str(),
requestId)) { target, requestId)) {
return; return;
} }
// aec2 // aec2
@ -192,8 +194,8 @@ void ESP3DCommands::ESP170(int cmd_params_pos, ESP3DMessage* msg) {
return; return;
} }
// agc // agc
if (!dispatchIdValue(json, "agc", String(s->status.agc).c_str(), target, if (!dispatchIdValue(json, "agc", String(s->status.agc).c_str(),
requestId)) { target, requestId)) {
return; return;
} }
// agc_gain // agc_gain
@ -209,18 +211,19 @@ void ESP3DCommands::ESP170(int cmd_params_pos, ESP3DMessage* msg) {
return; return;
} }
// bpc // bpc
if (!dispatchIdValue(json, "bpc", String(s->status.bpc).c_str(), target, if (!dispatchIdValue(json, "bpc", String(s->status.bpc).c_str(),
requestId)) { target, requestId)) {
return; return;
} }
// wpc // wpc
if (!dispatchIdValue(json, "wpc", String(s->status.wpc).c_str(), target, if (!dispatchIdValue(json, "wpc", String(s->status.wpc).c_str(),
requestId)) { target, requestId)) {
return; return;
} }
// raw_gma // raw_gma
if (!dispatchIdValue(json, "raw_gma", String(s->status.raw_gma).c_str(), if (!dispatchIdValue(json, "raw_gma",
target, requestId)) { String(s->status.raw_gma).c_str(), target,
requestId)) {
return; return;
} }
// lenc // lenc
@ -234,13 +237,14 @@ void ESP3DCommands::ESP170(int cmd_params_pos, ESP3DMessage* msg) {
return; return;
} }
// hmirror // hmirror
if (!dispatchIdValue(json, "hmirror", String(s->status.hmirror).c_str(), if (!dispatchIdValue(json, "hmirror",
target, requestId)) { String(s->status.hmirror).c_str(), target,
requestId)) {
return; return;
} }
// dcw // dcw
if (!dispatchIdValue(json, "dcw", String(s->status.dcw).c_str(), target, if (!dispatchIdValue(json, "dcw", String(s->status.dcw).c_str(),
requestId)) { target, requestId)) {
return; return;
} }
// colorbar // colorbar

View File

@ -48,10 +48,10 @@ void ESP3DCommands::ESP212(int cmd_params_pos, ESP3DMessage* msg) {
#endif // AUTHENTICATION_FEATURE #endif // AUTHENTICATION_FEATURE
tmpstr = get_clean_param(msg, cmd_params_pos); tmpstr = get_clean_param(msg, cmd_params_pos);
tmpstr = esp3d_string::expandString(tmpstr.c_str()); tmpstr = esp3d_string::expandString(tmpstr.c_str());
hasError = !esp3d_commands.dispatch(tmpstr.c_str(), ESP3DClientType::remote_screen, hasError = !esp3d_commands.dispatch(
no_id, ESP3DMessageType::unique, tmpstr.c_str(), ESP3DClientType::remote_screen, no_id,
ESP3DClientType::system, ESP3DMessageType::unique, ESP3DClientType::system,
ESP3DAuthenticationLevel::admin); ESP3DAuthenticationLevel::admin);
if (!dispatchAnswer(msg, COMMAND_ID, json, hasError, if (!dispatchAnswer(msg, COMMAND_ID, json, hasError,
hasError ? error_msg.c_str() : ok_msg.c_str())) { hasError ? error_msg.c_str() : ok_msg.c_str())) {
esp3d_log_e("Error sending response to clients"); esp3d_log_e("Error sending response to clients");

View File

@ -96,8 +96,8 @@ const char* FirmwareLabels[] = {"Unknown", "Grbl", "Marlin", "Smoothieware",
const char* FirmwareValues[] = {"0", "10", "20", "40", "50"}; const char* FirmwareValues[] = {"0", "10", "20", "40", "50"};
#ifdef NOTIFICATION_FEATURE #ifdef NOTIFICATION_FEATURE
const char* NotificationsLabels[] = {"none", "pushover", "email", const char* NotificationsLabels[] = {
"line", "telegram", "ifttt", "home-assistant"}; "none", "pushover", "email", "line", "telegram", "ifttt", "home-assistant"};
const char* NotificationsValues[] = {"0", "1", "2", "3", "4", "5", "6"}; const char* NotificationsValues[] = {"0", "1", "2", "3", "4", "5", "6"};
#endif // NOTIFICATION_FEATURE #endif // NOTIFICATION_FEATURE
@ -109,8 +109,8 @@ const char* SupportedApChannelsStr[] = {"1", "2", "3", "4", "5", "6", "7",
"8", "9", "10", "11", "12", "13", "14"}; "8", "9", "10", "11", "12", "13", "14"};
const char* SupportedBaudListSizeStr[] = { const char* SupportedBaudListSizeStr[] = {
"9600", "19200", "38400", "57600", "74880", "115200", "9600", "19200", "38400", "57600", "74880", "115200", "230400",
"230400", "250000", "500000", "921600", "1000000", "1958400","2000000"}; "250000", "500000", "921600", "1000000", "1958400", "2000000"};
#ifdef SENSOR_DEVICE #ifdef SENSOR_DEVICE

View File

@ -589,7 +589,7 @@ void ESP3DCommands::ESP420(int cmd_params_pos, ESP3DMessage* msg) {
#if COMMUNICATION_PROTOCOL == RAW_SERIAL || COMMUNICATION_PROTOCOL == MKS_SERIAL #if COMMUNICATION_PROTOCOL == RAW_SERIAL || COMMUNICATION_PROTOCOL == MKS_SERIAL
// serial enabled // serial enabled
if (esp3d_serial_service.started()) { if (esp3d_serial_service.started()) {
tmpstr = "ON (UART"; tmpstr = "ON (UART";
tmpstr += esp3d_serial_service.serialIndex(); tmpstr += esp3d_serial_service.serialIndex();
tmpstr += ")"; tmpstr += ")";
} else { } else {
@ -601,7 +601,7 @@ void ESP3DCommands::ESP420(int cmd_params_pos, ESP3DMessage* msg) {
} }
#endif // COMMUNICATION_PROTOCOL == RAW_SERIAL || COMMUNICATION_PROTOCOL == #endif // COMMUNICATION_PROTOCOL == RAW_SERIAL || COMMUNICATION_PROTOCOL ==
// MKS_SERIAL // MKS_SERIAL
#if defined (ESP_SERIAL_BRIDGE_OUTPUT) #if defined(ESP_SERIAL_BRIDGE_OUTPUT)
// serial bridge enabled // serial bridge enabled
if (serial_bridge_service.started()) { if (serial_bridge_service.started()) {
tmpstr = "ON (UART"; tmpstr = "ON (UART";
@ -610,11 +610,11 @@ void ESP3DCommands::ESP420(int cmd_params_pos, ESP3DMessage* msg) {
} else { } else {
tmpstr = "OFF"; tmpstr = "OFF";
} }
if (!dispatchIdValue(json, "serial_bridge", tmpstr.c_str(), target, requestId, if (!dispatchIdValue(json, "serial_bridge", tmpstr.c_str(), target, requestId,
false)) { false)) {
return; return;
} }
#endif // ESP_SERIAL_BRIDGE_OUTPUT #endif // ESP_SERIAL_BRIDGE_OUTPUT
#if defined(AUTHENTICATION_FEATURE) #if defined(AUTHENTICATION_FEATURE)
// authentication enabled // authentication enabled

View File

@ -42,8 +42,9 @@ void ESP3DCommands::ESP610(int cmd_params_pos, ESP3DMessage* msg) {
String tmpstr; String tmpstr;
const char* cmdList[] = {"type=", "T1=", "T2=", "TS="}; const char* cmdList[] = {"type=", "T1=", "T2=", "TS="};
uint8_t cmdListSize = sizeof(cmdList) / sizeof(char*); uint8_t cmdListSize = sizeof(cmdList) / sizeof(char*);
const char* notificationStr[] = {"NONE", "PUSHOVER", "EMAIL", const char* notificationStr[] = {"NONE", "PUSHOVER", "EMAIL",
"LINE", "TELEGRAM", "IFTTT", "HOMEASSISTANT"}; "LINE", "TELEGRAM", "IFTTT",
"HOMEASSISTANT"};
uint8_t notificationStrSize = sizeof(notificationStr) / sizeof(char*); uint8_t notificationStrSize = sizeof(notificationStr) / sizeof(char*);
const ESP3DSettingIndex settingIndex[] = { const ESP3DSettingIndex settingIndex[] = {
ESP_NOTIFICATION_TYPE, ESP_NOTIFICATION_TOKEN1, ESP_NOTIFICATION_TOKEN2, ESP_NOTIFICATION_TYPE, ESP_NOTIFICATION_TOKEN1, ESP_NOTIFICATION_TOKEN2,

View File

@ -20,41 +20,41 @@
#include "../include/esp3d_config.h" #include "../include/esp3d_config.h"
#if defined(ESP_BENCHMARK_FEATURE) #if defined(ESP_BENCHMARK_FEATURE)
#include "esp3d_benchmark.h"
#include "../modules/websocket/websocket_server.h" #include "../modules/websocket/websocket_server.h"
void report_esp3d(const char * format, ...) #include "esp3d_benchmark.h"
{ void report_esp3d(const char* format, ...) {
char buffer[64]; char buffer[64];
char* temp = buffer; char* temp = buffer;
va_list arg; va_list arg;
va_list copy; va_list copy;
va_start(arg, format); va_start(arg, format);
va_copy(copy, arg); va_copy(copy, arg);
size_t len = vsnprintf(NULL, 0, format, arg); size_t len = vsnprintf(NULL, 0, format, arg);
va_end(copy); va_end(copy);
if (len >= sizeof(buffer)) { if (len >= sizeof(buffer)) {
temp = new char[len + 1]; temp = new char[len + 1];
if (temp == NULL) { if (temp == NULL) {
return; 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;
} }
}
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) 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; float rate = 1.F * bench_transfered / (bench_end - bench_start) * 1000;
if (rate <1024) { if (rate < 1024) {
report_esp3d("REPORT: %s %llu bytes in %llu ms, %.2f bytes/s", title, bench_transfered, bench_end - bench_start, rate); report_esp3d("REPORT: %s %llu bytes in %llu ms, %.2f bytes/s", title,
} else { bench_transfered, bench_end - bench_start, rate);
report_esp3d("REPORT: %s %llu bytes in %llu ms, %.2f Kbytes/s", title, bench_transfered, bench_end - bench_start, rate/1024); } 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

View File

@ -20,6 +20,7 @@
#ifndef _BENCHMARK_ESP3D_H #ifndef _BENCHMARK_ESP3D_H
#define _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 benchMark(const char* title, uint64_t bench_start,
extern void report_esp3d(const char *format, ...); uint64_t bench_end, size_t bench_transfered);
#endif //_BENCHMARK_ESP3D_H extern void report_esp3d(const char* format, ...);
#endif //_BENCHMARK_ESP3D_H

View File

@ -42,8 +42,8 @@ enum class ESP3DClientType : uint8_t {
serial_bridge = 12, serial_bridge = 12,
remote_screen = 13, // target only = M117 remote_screen = 13, // target only = M117
mks_serial = 14, mks_serial = 14,
command, // origin only command, // origin only
system, // origin only system, // origin only
all_clients all_clients
}; };

View File

@ -694,7 +694,7 @@ void ESP3DCommands::execute_internal_command(int cmd, int cmd_params_pos,
break; break;
// Set/Get Notification settings // Set/Get Notification settings
//[ESP610]type=<NONE/PUSHOVER/EMAIL/LINE/HOMEASSISTANT> T1=<token1> //[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 // TS=<Settings> pwd=<admin password> Get will give type and settings only
// not the protected T1/T2 // not the protected T1/T2
case 610: case 610:
@ -1109,7 +1109,7 @@ bool ESP3DCommands::formatCommand(char *cmd, size_t len) {
cmd[sizestr + 1] = 0x0; cmd[sizestr + 1] = 0x0;
return true; return true;
} }
if (sizestr == len && cmd[sizestr-1] == '\n'){ if (sizestr == len && cmd[sizestr - 1] == '\n') {
return true; return true;
} }
return false; return false;
@ -1176,7 +1176,7 @@ bool ESP3DCommands::dispatch(ESP3DMessage *msg, uint8_t *sbuf, size_t len) {
esp3d_log_e("no msg"); esp3d_log_e("no msg");
return false; 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 || if (msg->type == ESP3DMessageType::unique ||
msg->type == ESP3DMessageType::tail) { msg->type == ESP3DMessageType::tail) {
esp3d_log("unique or tail message :*%s*", (char *)sbuf); esp3d_log("unique or tail message :*%s*", (char *)sbuf);

View File

@ -27,11 +27,11 @@
#include <soc/soc.h> #include <soc/soc.h>
#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2 #if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2
// FIXME : S3 not support it yet // FIXME : S3 not support it yet
# if __has_include ("rtc_wdt.h") #if __has_include("rtc_wdt.h")
#include <rtc_wdt.h> #include <rtc_wdt.h>
#else #else
#include <soc/rtc_wdt.h> #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 #endif // CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2
#include <WiFi.h> #include <WiFi.h>
#include <driver/adc.h> #include <driver/adc.h>

View File

@ -865,7 +865,8 @@ bool ESP3DSettings::isValidIntegerSetting(uint32_t value,
} }
} }
break; 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_WEBDAV_PORT:
case ESP_HTTP_PORT: case ESP_HTTP_PORT:
case ESP_TELNET_PORT: case ESP_TELNET_PORT:

View File

@ -28,7 +28,7 @@ const char* getContentType(const char* filename);
const char* encodeString(const char* s); const char* encodeString(const char* s);
const char* formatBytes(uint64_t bytes); const char* formatBytes(uint64_t bytes);
bool isPrintableChar(char c); 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 } // namespace esp3d_string
#endif //_ESP3D_STRING_H #endif //_ESP3D_STRING_H

View File

@ -21,75 +21,47 @@
*/ */
#pragma once #pragma once
//Use ESP3DLib instead of Marlin file // Use ESP3DLib instead of Marlin file
#include "../esp3d_config.h" #include "../esp3d_config.h"
//#include "../inc/MarlinConfig.h" // #include "../inc/MarlinConfig.h"
//stripped version of classreader // stripped version of classreader
#if defined(SDSUPPORT) && defined (ESP3DLIB_ENV) #if defined(SDSUPPORT) && defined(ESP3DLIB_ENV)
typedef struct { typedef struct {
bool saving:1, bool saving : 1, logging : 1, sdprinting : 1, sdprintdone : 1, mounted : 1,
logging:1, filenameIsDir : 1, workDirIsRoot : 1, abort_sd_printing : 1;
sdprinting:1,
sdprintdone:1,
mounted:1,
filenameIsDir:1,
workDirIsRoot:1,
abort_sd_printing:1;
} card_flags_t; } 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 private:
{
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:
}; };
#define IS_SD_PRINTING() (card.flag.sdprinting && !card.flag.abort_sd_printing)
#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_FETCHING() (!card.flag.sdprintdone && IS_SD_PRINTING()) #define IS_SD_PAUSED() card.isPaused()
#define IS_SD_PAUSED() card.isPaused()
#define IS_SD_FILE_OPEN() card.isFileOpen() #define IS_SD_FILE_OPEN() card.isFileOpen()
extern CardReader card; extern CardReader card;
#else // !SDSUPPORT #else // !SDSUPPORT
#define IS_SD_PRINTING() false #define IS_SD_PRINTING() false
#define IS_SD_FETCHING() false #define IS_SD_FETCHING() false
#define IS_SD_PAUSED() false #define IS_SD_PAUSED() false
#define IS_SD_FILE_OPEN() false #define IS_SD_FILE_OPEN() false
#endif // !SDSUPPORT #endif // !SDSUPPORT

View File

@ -40,76 +40,102 @@ typedef uint ESP3DSettingIndex;
// position in EEPROM / preferences will use `P_` + <position> to make a string // position in EEPROM / preferences will use `P_` + <position> to make a string
// : P_0 for 0 // : P_0 for 0
#define ESP_RADIO_MODE 0 // 1 byte = flag #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_SSID \
#define ESP_STA_PASSWORD 34 // 65 bytes 64 +1 = string ;warning does not support multibyte char like chinese 1 // 33 bytes 32+1 = string ; warning does not support multibyte char like
#define ESP_STA_IP_MODE 99 // 1 byte = flag // chinese
#define ESP_STA_IP_VALUE 100 // 4 bytes xxx.xxx.xxx.xxx #define ESP_STA_PASSWORD \
#define ESP_STA_MASK_VALUE 104 // 4 bytes xxx.xxx.xxx.xxx 34 // 65 bytes 64 +1 = string ;warning does not support multibyte char like
#define ESP_STA_GATEWAY_VALUE 108 // 4 bytes xxx.xxx.xxx.xxx // chinese
#define ESP_BAUD_RATE 112 // 4 bytes = int #define ESP_STA_IP_MODE 99 // 1 byte = flag
#define ESP_NOTIFICATION_TYPE 116 // 1 byte = flag #define ESP_STA_IP_VALUE 100 // 4 bytes xxx.xxx.xxx.xxx
#define ESP_CALIBRATION 117 // 1 byte = flag #define ESP_STA_MASK_VALUE 104 // 4 bytes xxx.xxx.xxx.xxx
#define ESP_AP_CHANNEL 118 // 1 byte = flag #define ESP_STA_GATEWAY_VALUE 108 // 4 bytes xxx.xxx.xxx.xxx
#define ESP_BUZZER 119 // 1 byte = flag #define ESP_BAUD_RATE 112 // 4 bytes = int
#define ESP_INTERNET_TIME 120 // 1 byte = flag #define ESP_NOTIFICATION_TYPE 116 // 1 byte = flag
#define ESP_HTTP_PORT 121 // 4 bytes = int #define ESP_CALIBRATION 117 // 1 byte = flag
#define ESP_TELNET_PORT 125 // 4 bytes = int #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 FREE 129 // 1 bytes = flag
#define ESP_HOSTNAME 130 // 33 bytes 32+1 = string ; warning does not support multibyte char like chinese #define ESP_HOSTNAME \
#define ESP_SENSOR_INTERVAL 164 // 4 bytes = int 130 // 33 bytes 32+1 = string ; warning does not support multibyte char like
#define ESP_SETTINGS_VERSION 168 // 8 bytes = 7+1 = string ESP3D + 2 digits // chinese
#define ESP_ADMIN_PWD 176 // 21 bytes 20+1 = string ; warning does not support multibyte char like chinese #define ESP_SENSOR_INTERVAL 164 // 4 bytes = int
#define ESP_USER_PWD 197 // 21 bytes 20+1 = string ; warning does not support multibyte char like chinese #define ESP_SETTINGS_VERSION 168 // 8 bytes = 7+1 = string ESP3D + 2 digits
#define ESP_AP_SSID 218 // 33 bytes 32+1 = string ; warning does not support multibyte char like chinese #define ESP_ADMIN_PWD \
#define ESP_AP_PASSWORD 251 // 65 bytes 64 +1 = string ;warning does not support multibyte char like chinese 176 // 21 bytes 20+1 = string ; warning does not support multibyte char
#define ESP_AP_IP_VALUE 316 // 4 bytes xxx.xxx.xxx.xxx // like chinese
#define ESP_BOOT_DELAY 320 // 4 bytes = int #define ESP_USER_PWD \
#define ESP_WEBSOCKET_PORT 324 // 4 bytes= int 197 // 21 bytes 20+1 = string ; warning does not support multibyte char
#define ESP_HTTP_ON 328 // 1 byte = flag // like chinese
#define ESP_TELNET_ON 329 // 1 byte = flag #define ESP_AP_SSID \
#define ESP_WEBSOCKET_ON 330 // 1 byte = flag 218 // 33 bytes 32+1 = string ; warning does not support multibyte char like
#define ESP_SD_SPEED_DIV 331 // 1 byte = flag // chinese
#define ESP_NOTIFICATION_TOKEN1 332 // 251 bytes 250+1 = string ; warning does not support multibyte char like chinese #define ESP_AP_PASSWORD \
#define ESP_NOTIFICATION_TOKEN2 583 // 64 bytes 63+1 = string ; warning does not support multibyte char like chinese 251 // 65 bytes 64 +1 = string ;warning does not support multibyte char like
#define ESP_SENSOR_TYPE 647 // 1 bytes = flag // chinese
#define ESP_TARGET_FW 648 // 1 bytes = flag #define ESP_AP_IP_VALUE 316 // 4 bytes xxx.xxx.xxx.xxx
#define ESP_FREE 649 // 1 bytes = flag #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 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_SERVER1 \
#define ESP_TIME_SERVER2 780 // 129 bytes 128+1 = string ; warning does not support multibyte char like chinese 651 // 129 bytes 128+1 = string ; warning does not support multibyte char
#define ESP_TIME_SERVER3 909 // 129 bytes 128+1 = string ; warning does not support multibyte char like chinese // 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 FREE 1038 // 1 bytes = flag
#define ESP_SD_MOUNT 1039 // 1 bytes = flag #define ESP_SD_MOUNT 1039 // 1 bytes = flag
#define ESP_SESSION_TIMEOUT 1040 // 1 bytes = flag #define ESP_SESSION_TIMEOUT 1040 // 1 bytes = flag
// #define FREE 1041 // 1 bytes = flag // #define FREE 1041 // 1 bytes = flag
#define ESP_SD_CHECK_UPDATE_AT_BOOT 1042 // 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_NOTIFICATION_SETTINGS \
#define ESP_CALIBRATION_1 1172 // 4 bytes = int 1043 // 129 bytes 128+1 = string ; warning does not support multibyte char
#define ESP_CALIBRATION_2 1176 // 4 bytes = int // like chinese
#define ESP_CALIBRATION_3 1180 // 4 bytes = int #define ESP_CALIBRATION_1 1172 // 4 bytes = int
#define ESP_CALIBRATION_4 1184 // 4 bytes = int #define ESP_CALIBRATION_2 1176 // 4 bytes = int
#define ESP_CALIBRATION_5 1188 // 4 bytes = int #define ESP_CALIBRATION_3 1180 // 4 bytes = int
#define ESP_SETUP 1192 // 1 byte = flag #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 1193 // 1 byte = flag
// #define FREE 1194 // 1 byte = flag // #define FREE 1194 // 1 byte = flag
// #define FREE 1195 // 1 byte = flag // #define FREE 1195 // 1 byte = flag
#define ESP_FTP_CTRL_PORT 1196 // 4 bytes = int #define ESP_FTP_CTRL_PORT 1196 // 4 bytes = int
#define ESP_FTP_DATA_ACTIVE_PORT 1200 // 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_DATA_PASSIVE_PORT 1204 // 4 bytes = int
#define ESP_FTP_ON 1208 // 1 byte = flag #define ESP_FTP_ON 1208 // 1 byte = flag
#define ESP_AUTO_NOTIFICATION 1209 // 1 byte = flag #define ESP_AUTO_NOTIFICATION 1209 // 1 byte = flag
#define ESP_VERBOSE_BOOT 1210 // 1 byte = flag #define ESP_VERBOSE_BOOT 1210 // 1 byte = flag
#define ESP_WEBDAV_ON 1211 // 1 byte = flag #define ESP_WEBDAV_ON 1211 // 1 byte = flag
#define ESP_WEBDAV_PORT 1212 // 4 bytes= int #define ESP_WEBDAV_PORT 1212 // 4 bytes= int
#define ESP_STA_DNS_VALUE 1216 // 4 bytes= int #define ESP_STA_DNS_VALUE 1216 // 4 bytes= int
#define ESP_SECURE_SERIAL 1220 // 1 byte = flag #define ESP_SECURE_SERIAL 1220 // 1 byte = flag
#define ESP_BOOT_RADIO_STATE 1221 // 1 byte = flag #define ESP_BOOT_RADIO_STATE 1221 // 1 byte = flag
#define ESP_STA_FALLBACK_MODE 1222 // 1 byte = flag #define ESP_STA_FALLBACK_MODE 1222 // 1 byte = flag
#define ESP_SERIAL_BRIDGE_ON 1223 // 1 byte = flag #define ESP_SERIAL_BRIDGE_ON 1223 // 1 byte = flag
// #define FREE 1224 // 1 byte = flag // #define FREE 1224 // 1 byte = flag
#define ESP_SERIAL_BRIDGE_BAUD 1225 // 4 bytes= int #define ESP_SERIAL_BRIDGE_BAUD 1225 // 4 bytes= int
#define ESP_TIME_ZONE 1229 // 7 bytes 6+1 = string #define ESP_TIME_ZONE 1229 // 7 bytes 6+1 = string
// Hidden password // Hidden password
#define HIDDEN_PASSWORD "********" #define HIDDEN_PASSWORD "********"

View File

@ -360,26 +360,26 @@
#if CAMERA_DEVICE == CAMERA_MODEL_XIAO_ESP32S3 #if CAMERA_DEVICE == CAMERA_MODEL_XIAO_ESP32S3
#define CAM_PULLUP1 -1 #define CAM_PULLUP1 -1
#define CAM_PULLUP2 -1 #define CAM_PULLUP2 -1
#define PWDN_GPIO_NUM -1 #define PWDN_GPIO_NUM -1
#define RESET_GPIO_NUM -1 #define RESET_GPIO_NUM -1
#define XCLK_GPIO_NUM 10 #define XCLK_GPIO_NUM 10
#define SIOD_GPIO_NUM 40 #define SIOD_GPIO_NUM 40
#define SIOC_GPIO_NUM 39 #define SIOC_GPIO_NUM 39
#define Y9_GPIO_NUM 48 #define Y9_GPIO_NUM 48
#define Y8_GPIO_NUM 11 #define Y8_GPIO_NUM 11
#define Y7_GPIO_NUM 12 #define Y7_GPIO_NUM 12
#define Y6_GPIO_NUM 14 #define Y6_GPIO_NUM 14
#define Y5_GPIO_NUM 16 #define Y5_GPIO_NUM 16
#define Y4_GPIO_NUM 18 #define Y4_GPIO_NUM 18
#define Y3_GPIO_NUM 17 #define Y3_GPIO_NUM 17
#define Y2_GPIO_NUM 15 #define Y2_GPIO_NUM 15
#define VSYNC_GPIO_NUM 38 #define VSYNC_GPIO_NUM 38
#define HREF_GPIO_NUM 47 #define HREF_GPIO_NUM 47
#define PCLK_GPIO_NUM 13 #define PCLK_GPIO_NUM 13
#define CAM_LED_PIN -1 #define CAM_LED_PIN -1
#endif // CAMERA_MODEL_XIAO_ESP32S3 #endif // CAMERA_MODEL_XIAO_ESP32S3
#if CAMERA_DEVICE == CAMERA_MODEL_UICPAL_ESP32S3 #if CAMERA_DEVICE == CAMERA_MODEL_UICPAL_ESP32S3
#define CAM_LED_PIN -1 #define CAM_LED_PIN -1

View File

@ -41,7 +41,7 @@
#if ESP_LOG_FEATURE == ESP_SERIAL_OUTPUT #if ESP_LOG_FEATURE == ESP_SERIAL_OUTPUT
#if not defined(ESP_NO_SANITY_CHECK) #if not defined(ESP_NO_SANITY_CHECK)
#warning You use same serial for output and log #warning You use same serial for output and log
#endif // SANITY_ESP3D_H #endif // SANITY_ESP3D_H
#endif // ESP_LOG_FEATURE == ESP_SERIAL_OUTPUT #endif // ESP_LOG_FEATURE == ESP_SERIAL_OUTPUT
#if (ESP_LOG_FEATURE == LOG_OUTPUT_SERIAL2) && defined(ARDUINO_ARCH_ESP8266) #if (ESP_LOG_FEATURE == LOG_OUTPUT_SERIAL2) && defined(ARDUINO_ARCH_ESP8266)
#error Serial 2 is not available in ESP8266 for log #error Serial 2 is not available in ESP8266 for log
@ -92,17 +92,20 @@
/************************** /**************************
* Hooks * 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 #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 #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 // 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 // #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(ESP_GOT_IP_HOOK) || defined(ESP_GOT_DATE_TIME_HOOK)
#if !defined(WIFI_FEATURE) && !defined(ETH_FEATURE) #if !defined(WIFI_FEATURE) && !defined(ETH_FEATURE)
#error Hooks need at least one network defined (WIFI_FEATURE or ETH_FEATURE) #error Hooks need at least one network defined (WIFI_FEATURE or ETH_FEATURE)
#endif //!defined(WIFI_FEATURE) && !defined(ETH_FEATURE) #endif //! defined(WIFI_FEATURE) && !defined(ETH_FEATURE)
#endif //#if defined(ESP_GOT_IP_HOOK) || defined(ESP_GOT_DATE_TIME_HOOK) #endif // #if defined(ESP_GOT_IP_HOOK) || defined(ESP_GOT_DATE_TIME_HOOK)
/************************** /**************************
* Filesystem * Filesystem
@ -195,4 +198,3 @@
#endif #endif
#endif // SANITY_CHECK #endif // SANITY_CHECK

View File

@ -70,7 +70,8 @@ class AuthenticationService {
static bool ClearCurrentHttpSession(); static bool ClearCurrentHttpSession();
static bool ClearAllSessions(); static bool ClearAllSessions();
static bool CreateSession(ESP3DAuthenticationLevel auth_level, static bool CreateSession(ESP3DAuthenticationLevel auth_level,
ESP3DClientType client_type, const char *session_ID); ESP3DClientType client_type,
const char *session_ID);
#endif // HTTP_FEATURE #endif // HTTP_FEATURE
private: private:
static String _adminpwd; static String _adminpwd;

View File

@ -73,7 +73,7 @@ void BootDelay::handle() {
ESP3DRequest reqId = { ESP3DRequest reqId = {
.id = ESP_OUTPUT_PROGRESS, .id = ESP_OUTPUT_PROGRESS,
}; };
#endif // DISPLAY_DEVICE #endif // DISPLAY_DEVICE
while ((millis() - _startdelay) < _totalduration) { while ((millis() - _startdelay) < _totalduration) {
#if defined(RECOVERY_FEATURE) #if defined(RECOVERY_FEATURE)
recovery_service.handle(); recovery_service.handle();

View File

@ -19,40 +19,36 @@
*/ */
#ifndef _BUZZER_H #ifndef _BUZZER_H
#define _BUZZER_H #define _BUZZER_H
#define BEEP_FREQUENCY 3000 #define BEEP_FREQUENCY 3000
struct tone_data { struct tone_data {
int frequency; int frequency;
int duration; int duration;
bool processing; bool processing;
tone_data * _next; tone_data* _next;
}; };
class BuzzerDevice class BuzzerDevice {
{ public:
public: BuzzerDevice();
BuzzerDevice(); ~BuzzerDevice();
~BuzzerDevice(); void playsound(int frequency, int duration);
void playsound(int frequency, int duration); bool started() { return _started; }
bool started() bool begin();
{ void end();
return _started; void handle();
} tone_data* getNextTone();
bool begin(); bool isPlaying();
void end(); void waitWhilePlaying();
void handle(); void beep(int count = 1, int delay = 0, int frequency = BEEP_FREQUENCY);
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();
private:
tone_data* _head;
tone_data* _tail;
bool _started;
void purgeData();
bool addToneToList(int frequency, int duration);
void no_tone();
}; };
extern BuzzerDevice esp3d_buzzer; extern BuzzerDevice esp3d_buzzer;
#endif //_BUZZER_H #endif //_BUZZER_H

View File

@ -18,40 +18,32 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#ifndef _CAMERA_H #ifndef _CAMERA_H
#define _CAMERA_H #define _CAMERA_H
#include <WebServer.h> #include <WebServer.h>
class Camera class Camera {
{ public:
public: Camera();
Camera(); ~Camera();
~Camera(); bool begin();
bool begin(); void end();
void end(); bool initHardware();
bool initHardware(); bool stopHardware();
bool stopHardware(); bool handle_snap(WebServer *webserver, const char *path = NULL,
bool handle_snap(WebServer * webserver, const char *path=NULL, const char* filename=NULL); const char *filename = NULL);
void handle(); void handle();
int command(const char * param, const char * value); int command(const char *param, const char *value);
uint8_t GetModel(); uint8_t GetModel();
const char *GetModelString(); const char *GetModelString();
bool started() bool started() { return _started; }
{ bool isinitialised() { return _initialised; }
return _started;
} private:
bool isinitialised() bool _initialised;
{ bool _started;
return _initialised;
}
private:
bool _initialised;
bool _started;
}; };
extern Camera esp3d_camera; extern Camera esp3d_camera;
#endif //_CAMERA_H #endif //_CAMERA_H

View File

@ -18,21 +18,17 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#ifndef _DEVICES_SERVICES_H #ifndef _DEVICES_SERVICES_H
#define _DEVICES_SERVICES_H #define _DEVICES_SERVICES_H
class DevicesServices {
public:
static bool begin();
static void end();
static void handle();
class DevicesServices private:
{ static bool _started;
public:
static bool begin();
static void end();
static void handle();
private:
static bool _started;
}; };
#endif //_DEVICES_SERVICES_H #endif //_DEVICES_SERVICES_H

View File

@ -23,7 +23,7 @@
#define ESP3D_Logo_width 62 #define ESP3D_Logo_width 62
#define ESP3D_Logo_height 45 #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, 0x00, 0x00, 0x00, 0xFE, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF,
0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0xFF, 0x01, 0x00, 0x00,
0x00, 0x00, 0xF8, 0xFF, 0xFF, 0x07, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFF, 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, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x1F, 0x00, 0x00, 0x00,
}; };
#endif //_esp3d_logo_h #endif //_esp3d_logo_h

View File

@ -18,34 +18,34 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
//Screen size // Screen size
#define SCREEN_WIDTH 128 #define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64 #define SCREEN_HEIGHT 64
//Colors // Colors
#define COLOR_BLACK BLACK #define COLOR_BLACK BLACK
#define COLOR_WHITE WHITE #define COLOR_WHITE WHITE
#define SPLASH_FG COLOR_BLACK #define SPLASH_FG COLOR_BLACK
#define SPLASH_BG COLOR_WHITE #define SPLASH_BG COLOR_WHITE
#define SCREEN_BG COLOR_BLACK #define SCREEN_BG COLOR_BLACK
#define PROGRESS_FG COLOR_WHITE #define PROGRESS_FG COLOR_WHITE
#define SIGNAL_FG COLOR_WHITE #define SIGNAL_FG COLOR_WHITE
#define SSID_FG COLOR_WHITE #define SSID_FG COLOR_WHITE
#define IP_FG COLOR_WHITE #define IP_FG COLOR_WHITE
#define STATUS_FG COLOR_WHITE #define STATUS_FG COLOR_WHITE
//Fonts // Fonts
#define FONTSIGNAL 2 #define FONTSIGNAL 2
#define FONTSSID 2 #define FONTSSID 2
#define FONTIP 3 #define FONTIP 3
#define FONTSTATUS 2 #define FONTSTATUS 2
//Positions // Positions
#define SIGNAL_X SCREEN_WIDTH-27 #define SIGNAL_X SCREEN_WIDTH - 27
#define SIGNAL_Y 0 #define SIGNAL_Y 0
#define SIGNAL_W 46 #define SIGNAL_W 46
#define SIGNAL_H 12 #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_Y 2
#define SIGNAL_ICON_W 15 #define SIGNAL_ICON_W 15
#define SIGNAL_ICON_H 10 #define SIGNAL_ICON_H 10
@ -63,6 +63,6 @@
#define IP_AREA_H 16 #define IP_AREA_H 16
#define STATUS_AREA_X 0 #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_W SCREEN_WIDTH
#define STATUS_AREA_H 16 #define STATUS_AREA_H 16

View File

@ -23,7 +23,7 @@
#define ESP3D_Logo_width 62 #define ESP3D_Logo_width 62
#define ESP3D_Logo_height 45 #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, 0x00, 0x00, 0x00, 0xFE, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF,
0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0xFF, 0x01, 0x00, 0x00,
0x00, 0x00, 0xF8, 0xFF, 0xFF, 0x07, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFF, 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, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x1F, 0x00, 0x00, 0x00,
}; };
#endif //_esp3d_logo_h #endif //_esp3d_logo_h

View File

@ -18,34 +18,34 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
//Screen size // Screen size
#define SCREEN_WIDTH 132 #define SCREEN_WIDTH 132
#define SCREEN_HEIGHT 64 #define SCREEN_HEIGHT 64
//Colors // Colors
#define COLOR_BLACK BLACK #define COLOR_BLACK BLACK
#define COLOR_WHITE WHITE #define COLOR_WHITE WHITE
#define SPLASH_FG COLOR_BLACK #define SPLASH_FG COLOR_BLACK
#define SPLASH_BG COLOR_WHITE #define SPLASH_BG COLOR_WHITE
#define SCREEN_BG COLOR_BLACK #define SCREEN_BG COLOR_BLACK
#define PROGRESS_FG COLOR_WHITE #define PROGRESS_FG COLOR_WHITE
#define SIGNAL_FG COLOR_WHITE #define SIGNAL_FG COLOR_WHITE
#define SSID_FG COLOR_WHITE #define SSID_FG COLOR_WHITE
#define IP_FG COLOR_WHITE #define IP_FG COLOR_WHITE
#define STATUS_FG COLOR_WHITE #define STATUS_FG COLOR_WHITE
//Fonts // Fonts
#define FONTSIGNAL 2 #define FONTSIGNAL 2
#define FONTSSID 2 #define FONTSSID 2
#define FONTIP 3 #define FONTIP 3
#define FONTSTATUS 2 #define FONTSTATUS 2
//Positions // Positions
#define SIGNAL_X 132-27 #define SIGNAL_X 132 - 27
#define SIGNAL_Y 0 #define SIGNAL_Y 0
#define SIGNAL_W 46 #define SIGNAL_W 46
#define SIGNAL_H 10 #define SIGNAL_H 10
#define SIGNAL_ICON_X 132-43 #define SIGNAL_ICON_X 132 - 43
#define SIGNAL_ICON_Y 2 #define SIGNAL_ICON_Y 2
#define SIGNAL_ICON_W 15 #define SIGNAL_ICON_W 15
#define SIGNAL_ICON_H 10 #define SIGNAL_ICON_H 10

View File

@ -23,97 +23,97 @@
#define ESP3D_Logo_width 100 #define ESP3D_Logo_width 100
#define ESP3D_Logo_height 83 #define ESP3D_Logo_height 83
const uint8_t ESP3D_Logo[] PROGMEM = { 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA0,
0x4B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xFE, 0xFF, 0x0B, 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, 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, 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, 0xFE, 0xFF, 0xFF, 0xFF, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 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, 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, 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, 0xF8, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 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, 0xFF, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xAE, 0xDD, 0xDD, 0xF7,
0x79, 0xBB, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 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, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x04,
0x48, 0x48, 0x10, 0x81, 0x44, 0x10, 0x08, 0x00, 0x00, 0x00, 0xD0, 0xFF, 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, 0xFF, 0xFF, 0x9F, 0x00, 0x00, 0x00, 0xF8,
0xFF, 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0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0xFE, 0xFF, 0xFF, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0xFE,
0xFF, 0xFF, 0xFF, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00,
0xFC, 0xFF, 0xFF, 0xFF, 0x07, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x03, 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, 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, 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, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x24, 0x49, 0x92, 0x24,
0x91, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 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, 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, 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, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xE0, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 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, 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, 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, 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, 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, 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, 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, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 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

View File

@ -18,35 +18,35 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
//Screen size // Screen size
#define SCREEN_WIDTH 240 #define SCREEN_WIDTH 240
#define SCREEN_HEIGHT 135 #define SCREEN_HEIGHT 135
//Colors // Colors
#define COLOR_BLACK TFT_BLACK #define COLOR_BLACK TFT_BLACK
#define COLOR_WHITE TFT_WHITE #define COLOR_WHITE TFT_WHITE
#define SPLASH_FG COLOR_WHITE #define SPLASH_FG COLOR_WHITE
#define SPLASH_BG COLOR_BLACK #define SPLASH_BG COLOR_BLACK
#define SCREEN_BG COLOR_BLACK #define SCREEN_BG COLOR_BLACK
#define PROGRESS_FG TFT_BLUE #define PROGRESS_FG TFT_BLUE
#define SIGNAL_FG TFT_CYAN #define SIGNAL_FG TFT_CYAN
#define SSID_FG TFT_ORANGE #define SSID_FG TFT_ORANGE
#define IP_FG COLOR_WHITE #define IP_FG COLOR_WHITE
#define STATUS_FG TFT_YELLOW #define STATUS_FG TFT_YELLOW
//Fonts // Fonts
#define FONTSIGNAL 2 #define FONTSIGNAL 2
#define FONTSSID 2 #define FONTSSID 2
#define FONTIP 4 #define FONTIP 4
#define FONTSTATUS 2 #define FONTSTATUS 2
//Positions // Positions
#define SIGNAL_X SCREEN_WIDTH-34 #define SIGNAL_X SCREEN_WIDTH - 34
#define SIGNAL_Y 0 #define SIGNAL_Y 0
#define SIGNAL_W 46 #define SIGNAL_W 46
#define SIGNAL_H 14 #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_Y 2
#define SIGNAL_ICON_W 23 #define SIGNAL_ICON_W 23
#define SIGNAL_ICON_H 10 #define SIGNAL_ICON_H 10
@ -59,11 +59,11 @@
#define SSID_AREA_H 14 #define SSID_AREA_H 14
#define IP_AREA_X 0 #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_W SCREEN_WIDTH
#define IP_AREA_H 20 #define IP_AREA_H 20
#define STATUS_AREA_X 0 #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_W SCREEN_WIDTH
#define STATUS_AREA_H 16 #define STATUS_AREA_H 16

View File

@ -23,97 +23,97 @@
#define ESP3D_Logo_width 100 #define ESP3D_Logo_width 100
#define ESP3D_Logo_height 83 #define ESP3D_Logo_height 83
const uint8_t ESP3D_Logo[] PROGMEM = { 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA0,
0x4B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xFE, 0xFF, 0x0B, 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, 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, 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, 0xFE, 0xFF, 0xFF, 0xFF, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 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, 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, 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, 0xF8, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 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, 0xFF, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xAE, 0xDD, 0xDD, 0xF7,
0x79, 0xBB, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 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, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x04,
0x48, 0x48, 0x10, 0x81, 0x44, 0x10, 0x08, 0x00, 0x00, 0x00, 0xD0, 0xFF, 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, 0xFF, 0xFF, 0x9F, 0x00, 0x00, 0x00, 0xF8,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x21, 0x22, 0xF8, 0x01, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x21, 0x22, 0xF8, 0x01, 0x00, 0x00,
0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0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, 0x06, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00,
0xFC, 0xFF, 0xFF, 0xFF, 0x07, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x03, 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, 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, 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, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x24, 0x49, 0x92, 0x24,
0x91, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 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, 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, 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, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xE0, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 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, 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, 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, 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, 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, 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, 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, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 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

View File

@ -18,35 +18,35 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
//Screen size // Screen size
#define SCREEN_WIDTH 240 #define SCREEN_WIDTH 240
#define SCREEN_HEIGHT 240 #define SCREEN_HEIGHT 240
//Colors // Colors
#define COLOR_BLACK TFT_BLACK #define COLOR_BLACK TFT_BLACK
#define COLOR_WHITE TFT_WHITE #define COLOR_WHITE TFT_WHITE
#define SPLASH_FG COLOR_WHITE #define SPLASH_FG COLOR_WHITE
#define SPLASH_BG COLOR_BLACK #define SPLASH_BG COLOR_BLACK
#define SCREEN_BG COLOR_BLACK #define SCREEN_BG COLOR_BLACK
#define PROGRESS_FG TFT_BLUE #define PROGRESS_FG TFT_BLUE
#define SIGNAL_FG TFT_CYAN #define SIGNAL_FG TFT_CYAN
#define SSID_FG TFT_ORANGE #define SSID_FG TFT_ORANGE
#define IP_FG COLOR_WHITE #define IP_FG COLOR_WHITE
#define STATUS_FG TFT_YELLOW #define STATUS_FG TFT_YELLOW
//Fonts // Fonts
#define FONTSIGNAL 2 #define FONTSIGNAL 2
#define FONTSSID 2 #define FONTSSID 2
#define FONTIP 4 #define FONTIP 4
#define FONTSTATUS 2 #define FONTSTATUS 2
//Positions // Positions
#define SIGNAL_X SCREEN_WIDTH-34 #define SIGNAL_X SCREEN_WIDTH - 34
#define SIGNAL_Y 0 #define SIGNAL_Y 0
#define SIGNAL_W 46 #define SIGNAL_W 46
#define SIGNAL_H 14 #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_Y 2
#define SIGNAL_ICON_W 23 #define SIGNAL_ICON_W 23
#define SIGNAL_ICON_H 10 #define SIGNAL_ICON_H 10
@ -59,11 +59,11 @@
#define SSID_AREA_H 14 #define SSID_AREA_H 14
#define IP_AREA_X 0 #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_W SCREEN_WIDTH
#define IP_AREA_H 20 #define IP_AREA_H 20
#define STATUS_AREA_X 0 #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_W SCREEN_WIDTH
#define STATUS_AREA_H 16 #define STATUS_AREA_H 16

View File

@ -18,54 +18,49 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#ifndef _ETH_CONFIG_H #ifndef _ETH_CONFIG_H
#define _ETH_CONFIG_H #define _ETH_CONFIG_H
#include <Arduino.h> #include <Arduino.h>
#ifdef ARDUINO_ARCH_ESP32 #ifdef ARDUINO_ARCH_ESP32
#include "../../include/esp3d_config.h" #include "../../include/esp3d_config.h"
#if defined (ESP3D_ETH_CLK_MODE) #if defined(ESP3D_ETH_CLK_MODE)
#define ETH_CLK_MODE (eth_clock_mode_t)ESP3D_ETH_CLK_MODE #define ETH_CLK_MODE (eth_clock_mode_t) ESP3D_ETH_CLK_MODE
#endif //ESP3D_ETH_CLK_MODE #endif // ESP3D_ETH_CLK_MODE
#if defined (ESP3D_ETH_PHY_POWER_PIN) #if defined(ESP3D_ETH_PHY_POWER_PIN)
#define ETH_PHY_POWER 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) #if defined(ESP3D_ETH_PHY_TYPE)
#define ETH_PHY_TYPE (eth_phy_type_t)ESP3D_ETH_PHY_TYPE #define ETH_PHY_TYPE (eth_phy_type_t) ESP3D_ETH_PHY_TYPE
#endif //ESP3D_ETH_PHY_TYPE #endif // ESP3D_ETH_PHY_TYPE
#if defined (ESP3D_ETH_PHY_MDC_PIN) #if defined(ESP3D_ETH_PHY_MDC_PIN)
#define ETH_PHY_MDC ESP3D_ETH_PHY_MDC_PIN #define ETH_PHY_MDC ESP3D_ETH_PHY_MDC_PIN
#endif //ESP3D_ETH_PHY_MDC_PIN #endif // ESP3D_ETH_PHY_MDC_PIN
#if defined (ESP3D_ETH_PHY_MDIO_PIN) #if defined(ESP3D_ETH_PHY_MDIO_PIN)
#define ETH_PHY_MDIO 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) #if defined(ESP3D_ETH_PHY_ADDR)
#define ETH_PHY_ADDR 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" #include "ETH.h"
#endif //ARDUINO_ARCH_ESP32 #endif // ARDUINO_ARCH_ESP32
#ifdef ARDUINO_ARCH_ESP8266 #ifdef ARDUINO_ARCH_ESP8266
#endif //ARDUINO_ARCH_ESP8266 #endif // ARDUINO_ARCH_ESP8266
class EthConfig class EthConfig {
{ public:
public: static bool begin(int8_t& espMode);
static bool begin(int8_t & espMode); static bool StartSTA();
static bool StartSTA(); // static bool StartSRV();
//static bool StartSRV(); static void end();
static void end(); static void handle();
static void handle(); static bool started();
static bool started(); static void setConnected(bool connected) { _connected = connected; }
static void setConnected(bool connected)
{
_connected = connected;
}
static bool linkUp(); static bool linkUp();
private :
static bool _started; private:
static bool _connected; static bool _started;
static bool _connected;
}; };
#endif //_ETH_CONFIG_H #endif //_ETH_CONFIG_H

View File

@ -24,7 +24,6 @@
#include "../../include/esp3d_config.h" #include "../../include/esp3d_config.h"
#define ESP_FLASH_FS_HEADER "/FS" #define ESP_FLASH_FS_HEADER "/FS"
#define ESP_MAX_OPENHANDLE 4 #define ESP_MAX_OPENHANDLE 4

View File

@ -27,7 +27,6 @@ littlefs_esp8266_filesystem.cpp - ESP3D littlefs filesystem configuration class
#include "../esp_filesystem.h" #include "../esp_filesystem.h"
Dir tDir_handle[ESP_MAX_OPENHANDLE]; Dir tDir_handle[ESP_MAX_OPENHANDLE];
extern File tFile_handle[ESP_MAX_OPENHANDLE]; extern File tFile_handle[ESP_MAX_OPENHANDLE];

View File

@ -230,7 +230,7 @@ bool ESP_SD::rename(const char* oldpath, const char* newpath) {
return SD.rename(oldpath, newpath); return SD.rename(oldpath, newpath);
} }
bool ESP_SD::format() { bool ESP_SD::format() {
uint32_t const ERASE_SIZE = 262144L; uint32_t const ERASE_SIZE = 262144L;
uint32_t cardSectorCount = 0; uint32_t cardSectorCount = 0;
uint8_t sectorBuffer[512]; uint8_t sectorBuffer[512];
@ -290,7 +290,7 @@ bool ESP_SD::format() {
: fatFormatter.format(m_card, sectorBuffer, nullptr); : fatFormatter.format(m_card, sectorBuffer, nullptr);
if (!rtn) { if (!rtn) {
esp3d_log_e("erase failed"); esp3d_log_e("erase failed");
return false; return false;
} }
@ -303,35 +303,35 @@ ESP_SDFile ESP_SD::open(const char* path, uint8_t mode) {
if (((strcmp(path, "/") == 0) && if (((strcmp(path, "/") == 0) &&
((mode == ESP_FILE_WRITE) || (mode == ESP_FILE_APPEND))) || ((mode == ESP_FILE_WRITE) || (mode == ESP_FILE_APPEND))) ||
(strlen(path) == 0)) { (strlen(path) == 0)) {
_sizechanged = true; _sizechanged = true;
esp3d_log_e("reject %s", path); esp3d_log_e("reject %s", path);
return ESP_SDFile(); return ESP_SDFile();
} }
// path must start by '/' // path must start by '/'
if (path[0] != '/') { if (path[0] != '/') {
esp3d_log_e("%s is invalid path", path); esp3d_log_e("%s is invalid path", path);
return ESP_SDFile(); return ESP_SDFile();
} }
if (mode != ESP_FILE_READ) { if (mode != ESP_FILE_READ) {
// check container exists // check container exists
String p = path; String p = path;
p.remove(p.lastIndexOf('/') + 1); p.remove(p.lastIndexOf('/') + 1);
if (!exists(p.c_str())) { if (!exists(p.c_str())) {
esp3d_log_e("Error opening: %s", path); esp3d_log_e("Error opening: %s", path);
return ESP_SDFile(); return ESP_SDFile();
} }
} }
File tmp = SD.open(path, (mode == ESP_FILE_READ) ? FILE_READ File tmp = SD.open(path, (mode == ESP_FILE_READ) ? FILE_READ
: (mode == ESP_FILE_WRITE) ? FILE_WRITE : (mode == ESP_FILE_WRITE) ? FILE_WRITE
: FILE_WRITE); : FILE_WRITE);
if (tmp) { if (tmp) {
ESP_SDFile esptmp(&tmp, strcmp(path, "/") == 0 ? true : tmp.isDir(), ESP_SDFile esptmp(&tmp, strcmp(path, "/") == 0 ? true : tmp.isDir(),
(mode == ESP_FILE_READ) ? false : true, path); (mode == ESP_FILE_READ) ? false : true, path);
esp3d_log("%s is a %s", path, tmp.isDir() ? "Dir" : "File"); esp3d_log("%s is a %s", path, tmp.isDir() ? "Dir" : "File");
return esptmp; return esptmp;
} else { } else {
esp3d_log_e("open %s failed", path); esp3d_log_e("open %s failed", path);
return ESP_SDFile(); return ESP_SDFile();
} }
} }
@ -339,14 +339,14 @@ bool ESP_SD::exists(const char* path) {
bool res = false; bool res = false;
// root should always be there if started // root should always be there if started
if (strcmp(path, "/") == 0) { if (strcmp(path, "/") == 0) {
return _started; return _started;
} }
res = SD.exists(path); res = SD.exists(path);
if (!res) { if (!res) {
ESP_SDFile root = ESP_SD::open(path, ESP_FILE_READ); ESP_SDFile root = ESP_SD::open(path, ESP_FILE_READ);
if (root) { if (root) {
res = root.isDirectory(); res = root.isDirectory();
} }
} }
return res; return res;
} }
@ -361,52 +361,52 @@ bool ESP_SD::mkdir(const char* path) { return SD.mkdir(path); }
bool ESP_SD::rmdir(const char* path) { bool ESP_SD::rmdir(const char* path) {
String p = path; String p = path;
if (!p.endsWith("/")) { if (!p.endsWith("/")) {
p += '/'; p += '/';
} }
if (!p.startsWith("/")) { if (!p.startsWith("/")) {
p = '/' + p; p = '/' + p;
} }
if (!exists(p.c_str())) { if (!exists(p.c_str())) {
return false; return false;
} }
bool res = true; bool res = true;
std::stack<String> pathlist; std::stack<String> pathlist;
pathlist.push(p); pathlist.push(p);
while (pathlist.size() > 0 && res) { while (pathlist.size() > 0 && res) {
File dir = SD.open(pathlist.top().c_str()); File dir = SD.open(pathlist.top().c_str());
dir.rewindDirectory(); dir.rewindDirectory();
File f = dir.openNextFile(); File f = dir.openNextFile();
bool candelete = true; bool candelete = true;
while (f && res) { while (f && res) {
if (f.isDir()) { if (f.isDir()) {
candelete = false; candelete = false;
String newdir; String newdir;
char tmp[255]; char tmp[255];
f.getName(tmp, 254); f.getName(tmp, 254);
newdir = pathlist.top() + tmp; newdir = pathlist.top() + tmp;
newdir += "/"; newdir += "/";
pathlist.push(newdir); pathlist.push(newdir);
f.close(); f.close();
f = File(); f = File();
} else { } else {
char tmp[255]; char tmp[255];
f.getName(tmp, 254); f.getName(tmp, 254);
_sizechanged = true; _sizechanged = true;
String filepath = pathlist.top() + tmp; String filepath = pathlist.top() + tmp;
f.close(); f.close();
if (!SD.remove(filepath.c_str())) { if (!SD.remove(filepath.c_str())) {
res = false; res = false;
} }
f = dir.openNextFile(); f = dir.openNextFile();
} }
} }
if (candelete) { if (candelete) {
if (pathlist.top() != "/") { if (pathlist.top() != "/") {
res = SD.rmdir(pathlist.top().c_str()); res = SD.rmdir(pathlist.top().c_str());
} }
pathlist.pop(); pathlist.pop();
} }
dir.close(); dir.close();
} }
p = String(); p = String();
esp3d_log("count %d has error %d\n", pathlist.size(), res); 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() { void ESP_SD::closeAll() {
for (uint8_t i = 0; i < ESP_MAX_SD_OPENHANDLE; i++) { for (uint8_t i = 0; i < ESP_MAX_SD_OPENHANDLE; i++) {
tSDFile_handle[i].close(); tSDFile_handle[i].close();
tSDFile_handle[i] = File(); tSDFile_handle[i] = File();
} }
} }
bool ESP_SDFile::seek(uint32_t pos, uint8_t mode) { bool ESP_SDFile::seek(uint32_t pos, uint8_t mode) {
if (mode == ESP_SEEK_END) { 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); return tSDFile_handle[_index].seek(pos);
} }
@ -438,46 +438,46 @@ ESP_SDFile::ESP_SDFile(void* handle, bool isdir, bool iswritemode,
_iswritemode = iswritemode; _iswritemode = iswritemode;
_size = 0; _size = 0;
if (!handle) { if (!handle) {
return; return;
} }
bool set = false; bool set = false;
for (uint8_t i = 0; (i < ESP_MAX_SD_OPENHANDLE) && !set; i++) { for (uint8_t i = 0; (i < ESP_MAX_SD_OPENHANDLE) && !set; i++) {
if (!tSDFile_handle[i]) { if (!tSDFile_handle[i]) {
tSDFile_handle[i] = *((File*)handle); tSDFile_handle[i] = *((File*)handle);
// filename // filename
char tmp[255]; char tmp[255];
tSDFile_handle[i].getName(tmp, 254); tSDFile_handle[i].getName(tmp, 254);
_filename = path; _filename = path;
// name // name
_name = tmp; _name = tmp;
if (_name.endsWith("/")) { if (_name.endsWith("/")) {
_name.remove(_name.length() - 1, 1); _name.remove(_name.length() - 1, 1);
_isdir = true; _isdir = true;
} }
if (_name[0] == '/') { if (_name[0] == '/') {
_name.remove(0, 1); _name.remove(0, 1);
} }
int pos = _name.lastIndexOf('/'); int pos = _name.lastIndexOf('/');
if (pos != -1) { if (pos != -1) {
_name.remove(0, pos + 1); _name.remove(0, pos + 1);
} }
if (_name.length() == 0) { if (_name.length() == 0) {
_name = "/"; _name = "/";
} }
// size // size
_size = tSDFile_handle[i].size(); _size = tSDFile_handle[i].size();
// time // time
if (!_isdir && !iswritemode) { if (!_isdir && !iswritemode) {
_lastwrite = getDateTimeFile(tSDFile_handle[i]); _lastwrite = getDateTimeFile(tSDFile_handle[i]);
} else { } else {
// no need date time for directory // no need date time for directory
_lastwrite = 0; _lastwrite = 0;
} }
_index = i; _index = i;
// esp3d_log("Opening File at index %d",_index); // esp3d_log("Opening File at index %d",_index);
set = true; set = true;
} }
} }
} }
// todo need also to add short filename // todo need also to add short filename
@ -488,56 +488,56 @@ const char* ESP_SDFile::shortname() const {
static char sname[13]; static char sname[13];
File ftmp = SD.open(_filename.c_str()); File ftmp = SD.open(_filename.c_str());
if (ftmp) { if (ftmp) {
ftmp.getSFN(sname, 12); ftmp.getSFN(sname, 12);
ftmp.close(); ftmp.close();
if (strlen(sname) == 0) { if (strlen(sname) == 0) {
return _name.c_str(); return _name.c_str();
} }
return sname; return sname;
} else { } else {
return _name.c_str(); return _name.c_str();
} }
#endif #endif
} }
void ESP_SDFile::close() { void ESP_SDFile::close() {
if (_index != -1) { if (_index != -1) {
// esp3d_log("Closing File at index %d", _index); // esp3d_log("Closing File at index %d", _index);
tSDFile_handle[_index].close(); tSDFile_handle[_index].close();
// reopen if mode = write // reopen if mode = write
// udate size + date // udate size + date
if (_iswritemode && !_isdir) { if (_iswritemode && !_isdir) {
File ftmp = SD.open(_filename.c_str()); File ftmp = SD.open(_filename.c_str());
if (ftmp) { if (ftmp) {
_size = ftmp.size(); _size = ftmp.size();
_lastwrite = getDateTimeFile(ftmp); _lastwrite = getDateTimeFile(ftmp);
ftmp.close(); ftmp.close();
} }
} }
tSDFile_handle[_index] = File(); tSDFile_handle[_index] = File();
// esp3d_log("Closing File at index %d",_index); // esp3d_log("Closing File at index %d",_index);
_index = -1; _index = -1;
} }
} }
ESP_SDFile ESP_SDFile::openNextFile() { ESP_SDFile ESP_SDFile::openNextFile() {
if ((_index == -1) || !_isdir) { if ((_index == -1) || !_isdir) {
esp3d_log("openNextFile failed"); esp3d_log("openNextFile failed");
return ESP_SDFile(); return ESP_SDFile();
} }
File tmp = tSDFile_handle[_index].openNextFile(); File tmp = tSDFile_handle[_index].openNextFile();
if (tmp) { if (tmp) {
char tmps[255]; char tmps[255];
tmp.getName(tmps, 254); tmp.getName(tmps, 254);
esp3d_log("tmp name :%s %s", tmps, (tmp.isDir()) ? "isDir" : "isFile"); esp3d_log("tmp name :%s %s", tmps, (tmp.isDir()) ? "isDir" : "isFile");
String s = _filename; String s = _filename;
if (s != "/") { if (s != "/") {
s += "/"; s += "/";
} }
s += tmps; s += tmps;
ESP_SDFile esptmp(&tmp, tmp.isDir(), false, s.c_str()); ESP_SDFile esptmp(&tmp, tmp.isDir(), false, s.c_str());
esptmp.close(); esptmp.close();
return esptmp; return esptmp;
} }
return ESP_SDFile(); return ESP_SDFile();
} }

View File

@ -269,92 +269,92 @@ bool ESP_SD::format() {
if (!rtn) { if (!rtn) {
esp3d_log_e("erase failed"); esp3d_log_e("erase failed");
return false; return false;
} }
return true; return true;
} }
esp3d_log_e("cannot erase"); esp3d_log_e("cannot erase");
return false; return false;
} }
ESP_SDFile ESP_SD::open(const char* path, uint8_t mode) { ESP_SDFile ESP_SD::open(const char* path, uint8_t mode) {
// do some check // do some check
if (((strcmp(path, "/") == 0) && if (((strcmp(path, "/") == 0) &&
((mode == ESP_FILE_WRITE) || (mode == ESP_FILE_APPEND))) || ((mode == ESP_FILE_WRITE) || (mode == ESP_FILE_APPEND))) ||
(strlen(path) == 0)) { (strlen(path) == 0)) {
_sizechanged = true; _sizechanged = true;
return ESP_SDFile(); return ESP_SDFile();
} }
// path must start by '/' // path must start by '/'
if (path[0] != '/') { if (path[0] != '/') {
return ESP_SDFile(); return ESP_SDFile();
} }
if (mode != ESP_FILE_READ) { if (mode != ESP_FILE_READ) {
// check container exists // check container exists
String p = path; String p = path;
p.remove(p.lastIndexOf('/') + 1); p.remove(p.lastIndexOf('/') + 1);
if (!exists(p.c_str())) { if (!exists(p.c_str())) {
esp3d_log("Error opening: %s", path); esp3d_log("Error opening: %s", path);
return ESP_SDFile(); return ESP_SDFile();
} }
} }
File tmp = SD.open(path, (mode == ESP_FILE_READ) ? FILE_READ File tmp = SD.open(path, (mode == ESP_FILE_READ) ? FILE_READ
: (mode == ESP_FILE_WRITE) ? FILE_WRITE : (mode == ESP_FILE_WRITE) ? FILE_WRITE
: FILE_WRITE); : FILE_WRITE);
ESP_SDFile esptmp(&tmp, tmp.isDir(), (mode == ESP_FILE_READ) ? false : true, ESP_SDFile esptmp(&tmp, tmp.isDir(), (mode == ESP_FILE_READ) ? false : true,
path); path);
return esptmp; return esptmp;
} }
bool ESP_SD::exists(const char* path) { bool ESP_SD::exists(const char* path) {
bool res = false; bool res = false;
// root should always be there if started // root should always be there if started
if (strcmp(path, "/") == 0) { if (strcmp(path, "/") == 0) {
return _started; return _started;
} }
esp3d_log("%s exists ?", path); esp3d_log("%s exists ?", path);
res = SD.exists(path); res = SD.exists(path);
if (!res) { if (!res) {
esp3d_log("Seems not - trying open it"); esp3d_log("Seems not - trying open it");
ESP_SDFile root = ESP_SD::open(path, ESP_FILE_READ); ESP_SDFile root = ESP_SD::open(path, ESP_FILE_READ);
if (root) { if (root) {
res = root.isDirectory(); res = root.isDirectory();
} }
} }
esp3d_log("Seems %s", res ? "yes" : "no"); esp3d_log("Seems %s", res ? "yes" : "no");
return res; return res;
} }
bool ESP_SD::remove(const char* path) { bool ESP_SD::remove(const char* path) {
_sizechanged = true; _sizechanged = true;
return SD.remove(path); return SD.remove(path);
} }
bool ESP_SD::mkdir(const char* path) { return SD.mkdir(path); } bool ESP_SD::mkdir(const char* path) { return SD.mkdir(path); }
bool ESP_SD::rmdir(const char* path) { bool ESP_SD::rmdir(const char* path) {
String p = path; String p = path;
if (!p.endsWith("/")) { if (!p.endsWith("/")) {
p += '/'; p += '/';
} }
if (!p.startsWith("/")) { if (!p.startsWith("/")) {
p = '/' + p; p = '/' + p;
} }
if (!exists(p.c_str())) { if (!exists(p.c_str())) {
return false; return false;
} }
bool res = true; bool res = true;
std::stack<String> pathlist; std::stack<String> pathlist;
pathlist.push(p); pathlist.push(p);
while (pathlist.size() > 0 && res) { while (pathlist.size() > 0 && res) {
File dir = SD.open(pathlist.top().c_str()); File dir = SD.open(pathlist.top().c_str());
dir.rewindDirectory(); dir.rewindDirectory();
File f = dir.openNextFile(); File f = dir.openNextFile();
bool candelete = true; bool candelete = true;
while (f && res) { while (f && res) {
if (f.isDir()) { if (f.isDir()) {
candelete = false; candelete = false;
String newdir; String newdir;
@ -376,54 +376,54 @@ bool ESP_SD::rmdir(const char* path) {
} }
f = dir.openNextFile(); f = dir.openNextFile();
} }
} }
if (candelete) { if (candelete) {
if (pathlist.top() != "/") { if (pathlist.top() != "/") {
res = SD.rmdir(pathlist.top().c_str()); res = SD.rmdir(pathlist.top().c_str());
} }
pathlist.pop(); pathlist.pop();
} }
dir.close(); dir.close();
} }
p = String(); p = String();
esp3d_log("count %d", pathlist.size()); esp3d_log("count %d", pathlist.size());
return res; return res;
} }
bool ESP_SDFile::seek(uint32_t pos, uint8_t mode) { bool ESP_SDFile::seek(uint32_t pos, uint8_t mode) {
if (mode == SeekCur) { if (mode == SeekCur) {
return tSDFile_handle[_index].seekCur(pos); return tSDFile_handle[_index].seekCur(pos);
} }
if (mode == SeekEnd) { if (mode == SeekEnd) {
return tSDFile_handle[_index].seekEnd(pos); return tSDFile_handle[_index].seekEnd(pos);
} }
// if (mode == SeekSet) // if (mode == SeekSet)
return tSDFile_handle[_index].seekSet(pos); return tSDFile_handle[_index].seekSet(pos);
} }
void ESP_SD::closeAll() { void ESP_SD::closeAll() {
for (uint8_t i = 0; i < ESP_MAX_SD_OPENHANDLE; i++) { for (uint8_t i = 0; i < ESP_MAX_SD_OPENHANDLE; i++) {
tSDFile_handle[i].close(); tSDFile_handle[i].close();
tSDFile_handle[i] = File(); tSDFile_handle[i] = File();
} }
} }
ESP_SDFile::ESP_SDFile(void* handle, bool isdir, bool iswritemode, ESP_SDFile::ESP_SDFile(void* handle, bool isdir, bool iswritemode,
const char* path) { const char* path) {
_isdir = isdir; _isdir = isdir;
_dirlist = ""; _dirlist = "";
_index = -1; _index = -1;
_filename = ""; _filename = "";
_name = ""; _name = "";
_lastwrite = 0; _lastwrite = 0;
_iswritemode = iswritemode; _iswritemode = iswritemode;
_size = 0; _size = 0;
if (!handle) { if (!handle) {
return; return;
} }
bool set = false; bool set = false;
for (uint8_t i = 0; (i < ESP_MAX_SD_OPENHANDLE) && !set; i++) { for (uint8_t i = 0; (i < ESP_MAX_SD_OPENHANDLE) && !set; i++) {
if (!tSDFile_handle[i]) { if (!tSDFile_handle[i]) {
tSDFile_handle[i] = *((File*)handle); tSDFile_handle[i] = *((File*)handle);
// filename // filename
char tmp[255]; char tmp[255];
@ -458,65 +458,65 @@ ESP_SDFile::ESP_SDFile(void* handle, bool isdir, bool iswritemode,
_index = i; _index = i;
// esp3d_log("Opening File at index %d",_index); // esp3d_log("Opening File at index %d",_index);
set = true; set = true;
} }
} }
} }
// todo need also to add short filename // todo need also to add short filename
const char* ESP_SDFile::shortname() const { const char* ESP_SDFile::shortname() const {
static char sname[13]; static char sname[13];
File ftmp = SD.open(_filename.c_str()); File ftmp = SD.open(_filename.c_str());
if (ftmp) { if (ftmp) {
ftmp.getSFN(sname, 12); ftmp.getSFN(sname, 12);
ftmp.close(); ftmp.close();
if (strlen(sname) == 0) { if (strlen(sname) == 0) {
return _name.c_str(); return _name.c_str();
} }
return sname; return sname;
} else { } else {
return _name.c_str(); return _name.c_str();
} }
} }
void ESP_SDFile::close() { void ESP_SDFile::close() {
if (_index != -1) { if (_index != -1) {
// esp3d_log("Closing File at index %d", _index); // esp3d_log("Closing File at index %d", _index);
tSDFile_handle[_index].close(); tSDFile_handle[_index].close();
// reopen if mode = write // reopen if mode = write
// udate size + date // udate size + date
if (_iswritemode && !_isdir) { if (_iswritemode && !_isdir) {
File ftmp = SD.open(_filename.c_str()); File ftmp = SD.open(_filename.c_str());
if (ftmp) { if (ftmp) {
_size = ftmp.size(); _size = ftmp.size();
_lastwrite = getDateTimeFile(ftmp); _lastwrite = getDateTimeFile(ftmp);
ftmp.close(); ftmp.close();
} }
} }
tSDFile_handle[_index] = File(); tSDFile_handle[_index] = File();
// esp3d_log("Closing File at index %d",_index); // esp3d_log("Closing File at index %d",_index);
_index = -1; _index = -1;
} }
} }
ESP_SDFile ESP_SDFile::openNextFile() { ESP_SDFile ESP_SDFile::openNextFile() {
if ((_index == -1) || !_isdir) { if ((_index == -1) || !_isdir) {
esp3d_log("openNextFile failed"); esp3d_log("openNextFile failed");
return ESP_SDFile(); return ESP_SDFile();
} }
File tmp = tSDFile_handle[_index].openNextFile(); File tmp = tSDFile_handle[_index].openNextFile();
if (tmp) { if (tmp) {
char tmps[255]; char tmps[255];
tmp.getName(tmps, 254); tmp.getName(tmps, 254);
esp3d_log("tmp name :%s %s", tmps, (tmp.isDir()) ? "isDir" : "isFile"); esp3d_log("tmp name :%s %s", tmps, (tmp.isDir()) ? "isDir" : "isFile");
String s = _filename; String s = _filename;
if (s != "/") { if (s != "/") {
s += "/"; s += "/";
} }
s += tmps; s += tmps;
ESP_SDFile esptmp(&tmp, tmp.isDir(), false, s.c_str()); ESP_SDFile esptmp(&tmp, tmp.isDir(), false, s.c_str());
esptmp.close(); esptmp.close();
return esptmp; return esptmp;
} }
return ESP_SDFile(); return ESP_SDFile();
} }
const char* ESP_SD::FilesystemName() { return "SDFat - " SD_FAT_VERSION_STR; } const char* ESP_SD::FilesystemName() { return "SDFat - " SD_FAT_VERSION_STR; }

View File

@ -101,7 +101,8 @@ uint8_t ESP_SD::getState(bool refresh) {
bool ESP_SD::begin() { bool ESP_SD::begin() {
#if SDIO_BIT_MODE == SD_ONE_BIT_MODE #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); SD_MMC.setPins(ESP_SDIO_CLK_PIN, ESP_SDIO_CMD_PIN, ESP_SDIO_D0_PIN);
#endif //(ESP_SDIO_CLK_PIN != -1) #endif //(ESP_SDIO_CLK_PIN != -1)
#else #else
@ -112,7 +113,7 @@ bool ESP_SD::begin() {
ESP_SDIO_D1_PIN, ESP_SDIO_D2_PIN, ESP_SDIO_D3_PIN); ESP_SDIO_D1_PIN, ESP_SDIO_D2_PIN, ESP_SDIO_D3_PIN);
#endif //(ESP_SDIO_CLK_PIN != -1) #endif //(ESP_SDIO_CLK_PIN != -1)
#endif // SD_ONE_BIT_MODE #endif // SD_ONE_BIT_MODE
esp3d_log("Begin SDIO"); esp3d_log("Begin SDIO");
_started = true; _started = true;
#ifdef SDMMC_FORCE_BEGIN #ifdef SDMMC_FORCE_BEGIN
_state = ESP_SDCARD_NOT_PRESENT; _state = ESP_SDCARD_NOT_PRESENT;

View File

@ -32,55 +32,50 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define STREAMING_LIBRARY_VERSION 5 #define STREAMING_LIBRARY_VERSION 5
// Generic template // Generic template
template<class T> template <class T>
inline Print &operator <<(Print &stream, T arg) inline Print &operator<<(Print &stream, T arg) {
{ stream.print(arg);
stream.print(arg); return stream;
return stream;
} }
struct _BASED { struct _BASED {
long val; long val;
int base; int base;
_BASED(long v, int b): val(v), base(b) _BASED(long v, int b) : val(v), base(b) {}
{}
}; };
#if ARDUINO >= 100 #if ARDUINO >= 100
struct _BYTE_CODE { struct _BYTE_CODE {
byte val; byte val;
_BYTE_CODE(byte v) : val(v) _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) inline Print &operator<<(Print &obj, const _BYTE_CODE &arg) {
{ obj.write(arg.val);
obj.write(arg.val); return obj;
return obj;
} }
#else #else
#define _BYTE(a) _BASED(a, BYTE) #define _BYTE(a) _BASED(a, BYTE)
#endif #endif
#define _HEX(a) _BASED(a, HEX) #define _HEX(a) _BASED(a, HEX)
#define _DEC(a) _BASED(a, DEC) #define _DEC(a) _BASED(a, DEC)
#define _OCT(a) _BASED(a, OCT) #define _OCT(a) _BASED(a, OCT)
#define _BIN(a) _BASED(a, BIN) #define _BIN(a) _BASED(a, BIN)
// Specialization for class _BASED // Specialization for class _BASED
// Thanks to Arduino forum user Ben Combee who suggested this // Thanks to Arduino forum user Ben Combee who suggested this
// clever technique to allow for expressions like // clever technique to allow for expressions like
// Serial << _HEX(a); // Serial << _HEX(a);
inline Print &operator <<(Print &obj, const _BASED &arg) inline Print &operator<<(Print &obj, const _BASED &arg) {
{ obj.print(arg.val, arg.base);
obj.print(arg.val, arg.base); return obj;
return obj;
} }
#if ARDUINO >= 18 #if ARDUINO >= 18
@ -91,16 +86,14 @@ inline Print &operator <<(Print &obj, const _BASED &arg)
// Serial << _FLOAT(gps_latitude, 6); // 6 digits of precision // Serial << _FLOAT(gps_latitude, 6); // 6 digits of precision
struct _FLOAT { struct _FLOAT {
float val; float val;
int digits; int digits;
_FLOAT(double v, int d): val(v), digits(d) _FLOAT(double v, int d) : val(v), digits(d) {}
{}
}; };
inline Print &operator <<(Print &obj, const _FLOAT &arg) inline Print &operator<<(Print &obj, const _FLOAT &arg) {
{ obj.print(arg.val, arg.digits);
obj.print(arg.val, arg.digits); return obj;
return obj;
} }
#endif #endif
@ -118,11 +111,10 @@ inline Print &operator <<(Print &obj, _EndLineCode arg)
enum _EndLineCode { eol }; enum _EndLineCode { eol };
inline Print &operator <<(Print &obj, _EndLineCode arg) inline Print &operator<<(Print &obj, _EndLineCode arg) {
{ (void)arg;
(void)arg; obj.print("\r\n");
obj.print( "\r\n" ); return obj;
return obj;
} }
#endif // EXT_STREAMING_H #endif // EXT_STREAMING_H

View File

@ -18,14 +18,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/* /*
* 2019-10-27 Modified version for ESP3D by Luc LEBOSSE @luc-github * 2019-10-27 Modified version for ESP3D by Luc LEBOSSE @luc-github
* support for ESP8266 and ESP32 in ESP3D project * support for ESP8266 and ESP32 in ESP3D project
*/ */
/******************************************************************************* /*******************************************************************************
** ** ** **
** DEFINITIONS FOR FTP SERVER ** ** DEFINITIONS FOR FTP SERVER **
** ** ** **
*******************************************************************************/ *******************************************************************************/
#ifndef FTP_SERVER_H #ifndef FTP_SERVER_H
@ -36,127 +36,123 @@ class WiFiClient;
#ifndef FF_MAX_LFN #ifndef FF_MAX_LFN
#define FF_MAX_LFN 255 #define FF_MAX_LFN 255
#endif #endif
#define FTP_TIME_OUT 5 * 60 // Disconnect client after 5 minutes of inactivity #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_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_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_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_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_BUF_SIZE 1024 // 512 // size of file buffer for read/write
#define FTP_SERVER WiFiServer #define FTP_SERVER WiFiServer
#define FTP_CLIENT WiFiClient #define FTP_CLIENT WiFiClient
#define CommandIs( a ) (command != NULL && ! strcmp_P( command, PSTR( a ))) #define CommandIs(a) (command != NULL && !strcmp_P(command, PSTR(a)))
#define ParameterIs( a ) ( parameter != NULL && ! strcmp_P( parameter, PSTR( a ))) #define ParameterIs(a) (parameter != NULL && !strcmp_P(parameter, PSTR(a)))
#include <time.h> #include <time.h>
enum ftpCmd { FTP_Stop = 0, // In this stage, stop any connection enum ftpCmd {
FTP_Init, // initialize some variables FTP_Stop = 0, // In this stage, stop any connection
FTP_Client, // wait for client connection FTP_Init, // initialize some variables
FTP_User, // wait for user name FTP_Client, // wait for client connection
FTP_Pass, // wait for user password FTP_User, // wait for user name
FTP_Cmd FTP_Pass, // wait for user password
}; // answers to commands FTP_Cmd
}; // answers to commands
enum ftpTransfer { FTP_Close = 0, // In this stage, close data channel enum ftpTransfer {
FTP_Retrieve, // retrieve file FTP_Close = 0, // In this stage, close data channel
FTP_Store, // store file FTP_Retrieve, // retrieve file
FTP_List, // list of files FTP_Store, // store file
FTP_Nlst, // list of name of files FTP_List, // list of files
FTP_Mlsd FTP_Nlst, // list of name of files
}; // listing for machine processing FTP_Mlsd
}; // listing for machine processing
enum ftpDataConn { FTP_NoConn = 0,// No data connexion enum ftpDataConn {
FTP_Pasive, // Pasive type FTP_NoConn = 0, // No data connexion
FTP_Active FTP_Pasive, // Pasive type
}; // Active type FTP_Active
}; // Active type
class FtpServer class FtpServer {
{ public:
public: FtpServer();
FtpServer(); ~FtpServer();
~FtpServer(); bool begin();
bool begin(); void handle();
void handle(); void end();
void end(); bool started();
bool started(); uint16_t ctrlport() { return ctrlPort; }
uint16_t ctrlport() uint16_t datapassiveport() { return passivePort; }
{ uint16_t dataactiveport() { return activePort; }
return ctrlPort; void closeClient();
} bool isConnected();
uint16_t datapassiveport() const char* clientIPAddress();
{ bool isUser(const char* user);
return passivePort; bool isPassword(const char* password);
} bool accessFS(const char* path);
uint16_t dataactiveport() void releaseFS();
{
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 );
bool getFileModTime(const char * path,time_t & time); private:
bool timeStamp( const char * path, uint16_t year, uint8_t month, uint8_t day, uint8_t hour, uint8_t minute, uint8_t second ); void iniVariables();
int8_t readChar(); void clientConnected();
uint8_t _fsType; void disconnectClient();
FTP_SERVER * ftpServer; bool processCommand();
FTP_SERVER * dataServer; bool haveParameter();
uint16_t ctrlPort; // Command port on wich server is listening int dataConnect(bool out150 = true);
uint16_t activePort; // Default data port in active mode bool dataConnected();
uint16_t passivePort; // Data port in passive mode bool doRetrieve();
bool _started; bool doStore();
uint8_t _root; bool doList();
IPAddress dataIp; // IP address of client for data bool doMlsd();
FTP_CLIENT client; void closeTransfer();
FTP_CLIENT data; 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 bool getFileModTime(const char* path, time_t& time);
ftpTransfer transferStage; // stage of data connexion bool timeStamp(const char* path, uint16_t year, uint8_t month, uint8_t day,
ftpDataConn dataConn; // type of data connexion 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() ftpCmd cmdStage; // stage of ftp command connexion
uint8_t buf[ FTP_BUF_SIZE ]; // data buffer for transfers ftpTransfer transferStage; // stage of data connexion
char cmdLine[ FTP_CMD_SIZE ]; // where to store incoming char from client ftpDataConn dataConn; // type of data connexion
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, // // uint8_t __attribute__((packed, aligned(4))) // need to be aligned to 32bit
millisEndConnection, // // for Esp8266 SPIClass::transferBytes()
millisBeginTrans, // store time of beginning of a transaction uint8_t buf[FTP_BUF_SIZE]; // data buffer for transfers
bytesTransfered; // char cmdLine[FTP_CMD_SIZE]; // where to store incoming char from client
String _currentUser; 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; extern FtpServer ftp_server;
#endif // FTP_SERVER_H #endif // FTP_SERVER_H

View File

@ -495,7 +495,7 @@ bool GcodeHost::processScript(const char *line,
ESP3DAuthenticationLevel auth_type) { ESP3DAuthenticationLevel auth_type) {
if (_step != HOST_NO_STREAM) { if (_step != HOST_NO_STREAM) {
esp3d_log("Streaming already in progress"); esp3d_log("Streaming already in progress");
while(_step != HOST_NO_STREAM){ while (_step != HOST_NO_STREAM) {
handle(); handle();
} }
} }
@ -506,7 +506,7 @@ bool GcodeHost::processScript(const char *line,
esp3d_log_e("No script to process"); esp3d_log_e("No script to process");
return false; return false;
} }
_fsType = TYPE_SCRIPT_STREAM; _fsType = TYPE_SCRIPT_STREAM;
_step = HOST_START_STREAM; _step = HOST_START_STREAM;
_auth_type = auth_type; _auth_type = auth_type;

File diff suppressed because it is too large Load Diff

View File

@ -20,29 +20,35 @@
#ifndef __favicon_h #ifndef __favicon_h
#define __favicon_h #define __favicon_h
#define favicon_size 344 #define favicon_size 344
const unsigned char favicon[344] PROGMEM = { const unsigned char favicon[344] PROGMEM = {
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xb5, 0x94, 0x31, 0x4b, 0xc3, 0x50, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xb5, 0x94,
0x14, 0x85, 0x4f, 0x63, 0xc1, 0x5a, 0x0b, 0x06, 0x91, 0x4e, 0x52, 0x3a, 0x44, 0x10, 0x27, 0x31, 0x31, 0x4b, 0xc3, 0x50, 0x14, 0x85, 0x4f, 0x63, 0xc1, 0x5a, 0x0b, 0x06,
0x45, 0xdc, 0xec, 0xd4, 0xdf, 0x21, 0x99, 0x44, 0x1c, 0x44, 0x74, 0x17, 0x9c, 0x8a, 0x73, 0x7f, 0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on_h 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

View File

@ -27,9 +27,9 @@
#if defined(ARDUINO_ARCH_ESP8266) #if defined(ARDUINO_ARCH_ESP8266)
#include <ESP8266WebServer.h> #include <ESP8266WebServer.h>
#endif // ARDUINO_ARCH_ESP8266 #endif // ARDUINO_ARCH_ESP8266
#include "../../../core/esp3d_string.h"
#include "../../authentication/authentication_service.h" #include "../../authentication/authentication_service.h"
#include "../../filesystem/esp_sd.h" #include "../../filesystem/esp_sd.h"
#include "../../../core/esp3d_string.h"
// SD // SD
// SD files list and file commands // SD files list and file commands
@ -239,9 +239,9 @@ void HTTP_Server::handleSDFileList() {
buffer2send += "\"occupation\":\"0\","; buffer2send += "\"occupation\":\"0\",";
} }
buffer2send += "\"status\":\"" + status + "\","; buffer2send += "\"status\":\"" + status + "\",";
buffer2send += "\"total\":\"" ; buffer2send += "\"total\":\"";
buffer2send += esp3d_string::formatBytes(ESP_SD::totalBytes()) ; buffer2send += esp3d_string::formatBytes(ESP_SD::totalBytes());
buffer2send += "\","; buffer2send += "\",";
buffer2send += "\"used\":\""; buffer2send += "\"used\":\"";
buffer2send += esp3d_string::formatBytes(ESP_SD::usedBytes()); buffer2send += esp3d_string::formatBytes(ESP_SD::usedBytes());
buffer2send += "\"}"; buffer2send += "\"}";

View File

@ -18,29 +18,28 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include "../../../include/esp3d_config.h" #include "../../../include/esp3d_config.h"
#if defined (HTTP_FEATURE) && defined (SSDP_FEATURE) #if defined(HTTP_FEATURE) && defined(SSDP_FEATURE)
#include "../http_server.h" #include "../http_server.h"
#if defined (ARDUINO_ARCH_ESP32) #if defined(ARDUINO_ARCH_ESP32)
#include <WebServer.h> #include <WebServer.h>
#ifdef SSDP_FEATURE #ifdef SSDP_FEATURE
#include <ESP32SSDP.h> #include <ESP32SSDP.h>
#endif //SSDP_FEATURE #endif // SSDP_FEATURE
#endif //ARDUINO_ARCH_ESP32 #endif // ARDUINO_ARCH_ESP32
#if defined (ARDUINO_ARCH_ESP8266) #if defined(ARDUINO_ARCH_ESP8266)
#include <ESP8266WebServer.h> #include <ESP8266WebServer.h>
#ifdef SSDP_FEATURE #ifdef SSDP_FEATURE
#include <ESP8266SSDP.h> #include <ESP8266SSDP.h>
#endif //SSDP_FEATURE #endif // SSDP_FEATURE
#endif //ARDUINO_ARCH_ESP8266 #endif // ARDUINO_ARCH_ESP8266
void HTTP_Server::handle_SSDP() void HTTP_Server::handle_SSDP() {
{ if (_webserver) {
if (_webserver) { #if defined(ARDUINO_ARCH_ESP32)
#if defined (ARDUINO_ARCH_ESP32) _webserver->send(200, "text/xml", SSDP.getSchema());
_webserver->send(200, "text/xml", SSDP.getSchema()); #endif // ARDUINO_ARCH_ESP32
#endif //ARDUINO_ARCH_ESP32 #if defined(ARDUINO_ARCH_ESP8266)
#if defined (ARDUINO_ARCH_ESP8266) SSDP.schema(_webserver->client());
SSDP.schema(_webserver->client()); #endif // ARDUINO_ARCH_ESP8266
#endif //ARDUINO_ARCH_ESP8266 }
}
} }
#endif //HTTP_FEATURE && SSDP_FEATURE #endif // HTTP_FEATURE && SSDP_FEATURE

View File

@ -20,21 +20,19 @@
#ifndef _INPUT_H #ifndef _INPUT_H
#define _INPUT_H #define _INPUT_H
class Input {
public:
Input();
~Input();
bool begin();
void end();
void handle();
bool started();
class Input private:
{ bool _started;
public:
Input();
~Input();
bool begin();
void end();
void handle();
bool started();
private:
bool _started;
}; };
extern Input esp3d_input; extern Input esp3d_input;
#endif //_INPUT_H #endif //_INPUT_H

View File

@ -20,21 +20,17 @@
#ifndef _LUA_INTERPRETER_H #ifndef _LUA_INTERPRETER_H
#define _LUA_INTERPRETER_H #define _LUA_INTERPRETER_H
class LuaInterpreter {
public:
LuaInterpreter();
~LuaInterpreter();
bool started() { return _started; }
bool begin();
void end();
void handle();
class LuaInterpreter private:
{ bool _started;
public:
LuaInterpreter();
~LuaInterpreter();
bool started()
{
return _started;
}
bool begin();
void end();
void handle();
private:
bool _started;
}; };
extern LuaInterpreter esp3d_lua_interpreter; extern LuaInterpreter esp3d_lua_interpreter;
#endif //_LUA_INTERPRETER_H #endif //_LUA_INTERPRETER_H

View File

@ -20,35 +20,32 @@
#ifndef _MDNS_H #ifndef _MDNS_H
#define _MDNS_H #define _MDNS_H
#include <Arduino.h> #include <Arduino.h>
class mDNS_Service class mDNS_Service {
{ public:
public: mDNS_Service();
mDNS_Service(); ~mDNS_Service();
~mDNS_Service(); bool started() { return _started; }
bool started() bool begin(const char* hostname);
{ void end();
return _started; void handle();
} void addESP3DServices(uint16_t port);
bool begin(const char * hostname); uint16_t servicesCount();
void end(); const char* answerHostname(uint16_t index);
void handle(); const char* answerIP(uint16_t index);
void addESP3DServices(uint16_t port); uint16_t answerPort(uint16_t index);
uint16_t servicesCount(); uint16_t answerTxtCount(uint16_t index);
const char* answerHostname(uint16_t index); const char* answerTxtKey(uint16_t index, uint16_t txtIndex);
const char* answerIP(uint16_t index); const char* answerTxt(uint16_t index, uint16_t txtIndex);
uint16_t answerPort(uint16_t index);
uint16_t answerTxtCount(uint16_t index); private:
const char* answerTxtKey(uint16_t index, uint16_t txtIndex); bool _started;
const char* answerTxt(uint16_t index, uint16_t txtIndex); uint16_t _port;
private: uint16_t _currentQueryCount;
bool _started; uint16_t _currentQueryTxtCount;
uint16_t _port; String _hostname;
uint16_t _currentQueryCount;
uint16_t _currentQueryTxtCount;
String _hostname;
#if defined(ARDUINO_ARCH_ESP8266) #if defined(ARDUINO_ARCH_ESP8266)
const void* _hMDNSServiceQuery; const void* _hMDNSServiceQuery;
#endif //ARDUINO_ARCH_ESP8266 #endif // ARDUINO_ARCH_ESP8266
}; };
extern mDNS_Service esp3d_mDNS; extern mDNS_Service esp3d_mDNS;
#endif //_MDNS_H #endif //_MDNS_H

View File

@ -46,7 +46,7 @@
#include "netservices.h" #include "netservices.h"
#if defined(GCODE_HOST_FEATURE) #if defined(GCODE_HOST_FEATURE)
#include "../gcode_host/gcode_host.h" #include "../gcode_host/gcode_host.h"
#endif // GCODE_HOST_FEATURE #endif // GCODE_HOST_FEATURE
String NetConfig::_hostname = ""; String NetConfig::_hostname = "";
bool NetConfig::_needReconnect2AP = false; bool NetConfig::_needReconnect2AP = false;
@ -214,11 +214,12 @@ void NetConfig::onWiFiEvent(WiFiEvent_t event) {
} break; } break;
case WIFI_EVENT_STAMODE_GOT_IP: { case WIFI_EVENT_STAMODE_GOT_IP: {
#if COMMUNICATION_PROTOCOL != MKS_SERIAL #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); String ipMsg = esp3d_string::expandString(ESP_GOT_IP_HOOK);
esp3d_log("Got IP, sending hook: %s", ipMsg.c_str()); esp3d_log("Got IP, sending hook: %s", ipMsg.c_str());
esp3d_gcode_host.processScript(ipMsg.c_str(), ESP3DAuthenticationLevel::admin); esp3d_gcode_host.processScript(ipMsg.c_str(),
#endif // #if defined (ESP_GOT_IP_HOOK) && defined (GCODE_HOST_FEATURE) ESP3DAuthenticationLevel::admin);
#endif // #if defined (ESP_GOT_IP_HOOK) && defined (GCODE_HOST_FEATURE)
#endif // #if COMMUNICATION_PROTOCOL == MKS_SERIAL #endif // #if COMMUNICATION_PROTOCOL == MKS_SERIAL
} break; } break;
case WIFI_EVENT_SOFTAPMODE_STACONNECTED: { case WIFI_EVENT_SOFTAPMODE_STACONNECTED: {
@ -256,17 +257,17 @@ void NetConfig::onWiFiEvent(WiFiEvent_t event) {
ESP3DAuthenticationLevel::admin); ESP3DAuthenticationLevel::admin);
EthConfig::setConnected(false); EthConfig::setConnected(false);
} break; } break;
case ARDUINO_EVENT_ETH_GOT_IP:{ case ARDUINO_EVENT_ETH_GOT_IP: {
#if COMMUNICATION_PROTOCOL != MKS_SERIAL #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); String ipMsg = esp3d_string::expandString(ESP_GOT_IP_HOOK);
esp3d_log("Got IP, sending hook: %s", ipMsg.c_str()); esp3d_log("Got IP, sending hook: %s", ipMsg.c_str());
esp3d_gcode_host.processScript(ipMsg.c_str(), ESP3DAuthenticationLevel::admin); esp3d_gcode_host.processScript(ipMsg.c_str(),
#endif // #if defined (ESP_GOT_IP_HOOK) && defined (GCODE_HOST_FEATURE) ESP3DAuthenticationLevel::admin);
#endif // #if defined (ESP_GOT_IP_HOOK) && defined (GCODE_HOST_FEATURE)
#endif // #if COMMUNICATION_PROTOCOL == MKS_SERIAL #endif // #if COMMUNICATION_PROTOCOL == MKS_SERIAL
EthConfig::setConnected(true); EthConfig::setConnected(true);
} } break;
break;
case ARDUINO_EVENT_ETH_STOP: case ARDUINO_EVENT_ETH_STOP:
EthConfig::setConnected(false); EthConfig::setConnected(false);
break; break;

View File

@ -488,8 +488,9 @@ void NetServices::handle() {
#ifdef NOTIFICATION_FEATURE #ifdef NOTIFICATION_FEATURE
notificationsservice.handle(); notificationsservice.handle();
#endif // NOTIFICATION_FEATURE #endif // NOTIFICATION_FEATURE
#if defined (TIMESTAMP_FEATURE) && (defined (ESP_GOT_IP_HOOK) || defined (ESP_GOT_DATE_TIME_HOOK)) #if defined(TIMESTAMP_FEATURE) && \
timeService.handle(); (defined(ESP_GOT_IP_HOOK) || defined(ESP_GOT_DATE_TIME_HOOK))
timeService.handle();
#endif // TIMESTAMP_FEATURE #endif // TIMESTAMP_FEATURE
} }
if (_restart) { if (_restart) {

View File

@ -18,26 +18,19 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#ifndef _NET_SERVICES_H #ifndef _NET_SERVICES_H
#define _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 private:
{ static bool _started;
public: static bool _restart;
static bool begin();
static void end();
static void handle();
static bool started()
{
return _started;
}
private:
static bool _started;
static bool _restart;
}; };
#endif //_NET_SERVICES_H #endif //_NET_SERVICES_H

View File

@ -102,9 +102,8 @@ void NotificationsService::BearSSLSetup(WiFiClientSecure& Notificationclient) {
#endif // ARDUINO_ARCH_ESP8266 #endif // ARDUINO_ARCH_ESP8266
// TODO: put error in variable to allow better error handling // TODO: put error in variable to allow better error handling
template<typename T> template <typename T>
bool NotificationsService::Wait4Answer(T& client, bool NotificationsService::Wait4Answer(T& client, const char* linetrigger,
const char* linetrigger,
const char* expected_answer, const char* expected_answer,
uint32_t timeout) { uint32_t timeout) {
if (client.connected()) { if (client.connected()) {
@ -184,15 +183,15 @@ bool NotificationsService::sendMSG(const char* title, const char* messagetxt) {
if (!((strlen(title) == 0) && (strlen(messagetxt) == 0))) { if (!((strlen(title) == 0) && (strlen(messagetxt) == 0))) {
String message = esp3d_string::expandString(messagetxt); String message = esp3d_string::expandString(messagetxt);
if (_notificationType != ESP_HOMEASSISTANT_NOTIFICATION) { if (_notificationType != ESP_HOMEASSISTANT_NOTIFICATION) {
// push to webui by default // push to webui by default
#if defined(HTTP_FEATURE) || defined(WS_DATA_FEATURE) #if defined(HTTP_FEATURE) || defined(WS_DATA_FEATURE)
String msg = "NOTIFICATION:"; String msg = "NOTIFICATION:";
msg += message; msg += message;
websocket_terminal_server.pushMSG(msg.c_str()); websocket_terminal_server.pushMSG(msg.c_str());
#endif // HTTP_FEATURE || WS_DATA_FEATURE #endif // HTTP_FEATURE || WS_DATA_FEATURE
#ifdef DISPLAY_DEVICE #ifdef DISPLAY_DEVICE
esp3d_display.setStatus(message.c_str()); esp3d_display.setStatus(message.c_str());
#endif // DISPLAY_DEVICE #endif // DISPLAY_DEVICE
} }
switch (_notificationType) { switch (_notificationType) {
case ESP_PUSHOVER_NOTIFICATION: case ESP_PUSHOVER_NOTIFICATION:
@ -504,7 +503,7 @@ bool NotificationsService::sendIFTTTMSG(const char* title,
// Home Assistant // Home Assistant
bool NotificationsService::sendHomeAssistantMSG(const char* title, bool NotificationsService::sendHomeAssistantMSG(const char* title,
const char* message) { const char* message) {
WiFiClient Notificationclient; WiFiClient Notificationclient;
(void)title; (void)title;
if (!Notificationclient.connect(_serveraddress.c_str(), _port)) { if (!Notificationclient.connect(_serveraddress.c_str(), _port)) {
@ -518,21 +517,32 @@ bool NotificationsService::sendHomeAssistantMSG(const char* title,
String path = tmp.substring(0, pos); String path = tmp.substring(0, pos);
String json = tmp.substring(pos + 1); String json = tmp.substring(pos + 1);
// build post query // build post query
String postcmd = "POST " + path + " HTTP/1.1\r\n" String postcmd =
"Host: " + _serveraddress.c_str() + "\r\n" "POST " + path +
"Connection: close\r\n" " HTTP/1.1\r\n"
"Cache-Control: no-cache\r\n" "Host: " +
"User-Agent: ESP3D\r\n" _serveraddress.c_str() +
"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n" "\r\n"
"Authorization: Bearer " + _token1 + "\r\n" "Connection: close\r\n"
"Content-Type: application/json\r\n" "Cache-Control: no-cache\r\n"
"Content-Length: " + json.length() + "\r\n" "User-Agent: ESP3D\r\n"
"\r\n" + json; "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()); // esp3d_log("Query: %s", postcmd.c_str());
// send query // send query
Notificationclient.print(postcmd); Notificationclient.print(postcmd);
bool res = Wait4Answer(Notificationclient, "200 OK", "200 OK", HOMEASSISTANTTIMEOUT); bool res =
Wait4Answer(Notificationclient, "200 OK", "200 OK", HOMEASSISTANTTIMEOUT);
Notificationclient.stop(); Notificationclient.stop();
return res; return res;
} }
@ -555,7 +565,7 @@ bool NotificationsService::getPortFromSettings() {
// Email#serveraddress:port or serveraddress:port // Email#serveraddress:port or serveraddress:port
bool NotificationsService::getServerAddressFromSettings() { bool NotificationsService::getServerAddressFromSettings() {
String tmp = ESP3DSettings::readString(ESP_NOTIFICATION_SETTINGS); 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(':'); int pos2 = tmp.lastIndexOf(':');
if (pos2 == -1) return false; if (pos2 == -1) return false;
_serveraddress = tmp.substring(pos1 + 1, pos2); _serveraddress = tmp.substring(pos1 + 1, pos2);

View File

@ -60,7 +60,7 @@ class NotificationsService {
bool getPortFromSettings(); bool getPortFromSettings();
bool getServerAddressFromSettings(); bool getServerAddressFromSettings();
bool getEmailFromSettings(); bool getEmailFromSettings();
template<typename T> template <typename T>
bool Wait4Answer(T& client, const char* linetrigger, bool Wait4Answer(T& client, const char* linetrigger,
const char* expected_answer, uint32_t timeout); const char* expected_answer, uint32_t timeout);
}; };

View File

@ -18,26 +18,23 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#ifndef _RECOVERY_SERVICE_H #ifndef _RECOVERY_SERVICE_H
#define _RECOVERY_SERVICE_H #define _RECOVERY_SERVICE_H
class RecoveryService class RecoveryService {
{ public:
public: RecoveryService();
RecoveryService(); ~RecoveryService();
~RecoveryService(); bool begin();
bool begin(); void end();
void end(); void handle();
void handle(); bool started();
bool started();
private: private:
bool _started; bool _started;
uint32_t _servicetimeout; uint32_t _servicetimeout;
}; };
extern RecoveryService recovery_service; extern RecoveryService recovery_service;
#endif //_RECOVERY_SERVICE_H #endif //_RECOVERY_SERVICE_H

View File

@ -18,28 +18,24 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#ifndef _ANALOG_SENSOR_H #ifndef _ANALOG_SENSOR_H
#define _ANALOG_SENSOR_H #define _ANALOG_SENSOR_H
#include "sensor.h" #include "sensor.h"
class AnalogSensorDevice : ESP3DSensorDevice class AnalogSensorDevice : ESP3DSensorDevice {
{ public:
public: AnalogSensorDevice();
AnalogSensorDevice(); ~AnalogSensorDevice();
~AnalogSensorDevice(); bool begin();
bool begin(); void end();
void end(); bool isModelValid(uint8_t model);
bool isModelValid(uint8_t model); uint8_t getIDFromString(const char *);
uint8_t getIDFromString(const char *); uint8_t nbType();
uint8_t nbType(); uint8_t GetModel(uint8_t i = 0);
uint8_t GetModel(uint8_t i=0); const char *GetModelString(uint8_t i = 0);
const char *GetModelString(uint8_t i=0); const char *GetCurrentModelString();
const char *GetCurrentModelString(); const char *GetData();
const char * GetData();
}; };
#endif //_ANALOG_SENSOR_H #endif //_ANALOG_SENSOR_H

View File

@ -117,16 +117,16 @@ uint8_t BMX280SensorDevice::GetModel(uint8_t i) {
const char *BMX280SensorDevice::GetCurrentModelString() { const char *BMX280SensorDevice::GetCurrentModelString() {
uint8_t sensortype = ESP3DSettings::readByte(ESP_SENSOR_TYPE); uint8_t sensortype = ESP3DSettings::readByte(ESP_SENSOR_TYPE);
for (uint8_t i = 0; i < NB_TYPE_SENSOR; i++) { 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 SENSOR_NAME[i];
} }
} }
return "NONE"; return "NONE";
} }
const char *BMX280SensorDevice::GetModelString(uint8_t i) { const char *BMX280SensorDevice::GetModelString(uint8_t i) {
if (i < NB_TYPE_SENSOR) { if (i < NB_TYPE_SENSOR) {
return SENSOR_NAME[i]; return SENSOR_NAME[i];
} }
return "NONE"; return "NONE";
} }
@ -137,48 +137,48 @@ float toFahrenheit(float fromCelcius) { return 1.8 * fromCelcius + 32.0; };
const char *BMX280SensorDevice::GetData() { const char *BMX280SensorDevice::GetData() {
static String s; static String s;
if (bmx280_device) { if (bmx280_device) {
if (!bmx280_device->measure()) { if (!bmx280_device->measure()) {
s = "BUSY"; s = "BUSY";
esp3d_log("sensor is busy"); esp3d_log("sensor is busy");
} else { } else {
uint8_t nbtry = 0; uint8_t nbtry = 0;
do { do {
esp3d_log("try sensor %d", nbtry); esp3d_log("try sensor %d", nbtry);
ESP3DHal::wait(100); ESP3DHal::wait(100);
nbtry++; nbtry++;
} while (!bmx280_device->hasValue() && nbtry < 3); } while (!bmx280_device->hasValue() && nbtry < 3);
if (bmx280_device->hasValue()) { if (bmx280_device->hasValue()) {
float temperature = bmx280_device->getTemperature(); float temperature = bmx280_device->getTemperature();
float pressure = bmx280_device->getPressure(); float pressure = bmx280_device->getPressure();
float humidity = 0; float humidity = 0;
if (bmx280_device->isBME280()) { if (bmx280_device->isBME280()) {
humidity = bmx280_device->getHumidity(); 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");
}
} }
} 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"; 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(); return s.c_str();
} }

View File

@ -18,27 +18,23 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#ifndef _BMX280_SENSOR_H #ifndef _BMX280_SENSOR_H
#define _BMX280_SENSOR_H #define _BMX280_SENSOR_H
#include "sensor.h" #include "sensor.h"
class BMX280SensorDevice : ESP3DSensorDevice class BMX280SensorDevice : ESP3DSensorDevice {
{ public:
public: BMX280SensorDevice();
BMX280SensorDevice(); ~BMX280SensorDevice();
~BMX280SensorDevice(); bool begin();
bool begin(); void end();
void end(); bool isModelValid(uint8_t model);
bool isModelValid(uint8_t model); uint8_t getIDFromString(const char *);
uint8_t getIDFromString(const char *); uint8_t nbType();
uint8_t nbType(); uint8_t GetModel(uint8_t i = 0);
uint8_t GetModel(uint8_t i=0); const char *GetModelString(uint8_t i = 0);
const char *GetModelString(uint8_t i=0); const char *GetCurrentModelString();
const char *GetCurrentModelString(); const char *GetData();
const char * GetData();
}; };
#endif //_BMX280_SENSOR_H #endif //_BMX280_SENSOR_H

View File

@ -18,28 +18,24 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#ifndef _DHT_SENSOR_H #ifndef _DHT_SENSOR_H
#define _DHT_SENSOR_H #define _DHT_SENSOR_H
#include "sensor.h" #include "sensor.h"
class DHTSensorDevice : ESP3DSensorDevice class DHTSensorDevice : ESP3DSensorDevice {
{ public:
public: DHTSensorDevice();
DHTSensorDevice(); ~DHTSensorDevice();
~DHTSensorDevice(); bool begin();
bool begin(); void end();
void end(); bool isModelValid(uint8_t model);
bool isModelValid(uint8_t model); uint8_t getIDFromString(const char *);
uint8_t getIDFromString(const char *); uint8_t nbType();
uint8_t nbType(); uint8_t GetModel(uint8_t i = 0);
uint8_t GetModel(uint8_t i=0); const char *GetModelString(uint8_t i = 0);
const char *GetModelString(uint8_t i=0); const char *GetCurrentModelString();
const char *GetCurrentModelString(); const char *GetData();
const char * GetData();
}; };
#endif //_DHT_SENSOR_H #endif //_DHT_SENSOR_H

View File

@ -18,84 +18,49 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#ifndef _ESP3D_SENSOR_H #ifndef _ESP3D_SENSOR_H
#define _ESP3D_SENSOR_H #define _ESP3D_SENSOR_H
class ESP3DSensorDevice class ESP3DSensorDevice {
{ public:
public: ESP3DSensorDevice() {}
ESP3DSensorDevice() {} virtual ~ESP3DSensorDevice() {}
virtual ~ESP3DSensorDevice() {} virtual bool begin() { return false; }
virtual bool begin() virtual void end() {}
{ virtual bool isModelValid(uint8_t model) { return false; }
return false; virtual uint8_t getIDFromString(const char *) { return 0; }
} virtual uint8_t nbType() { return 0; }
virtual void end() {} virtual uint8_t GetModel(uint8_t i = 0) { return 0; }
virtual bool isModelValid(uint8_t model) virtual const char *GetCurrentModelString() { return "None"; }
{ virtual const char *GetModelString(uint8_t i = 0) { return "None"; }
return false; virtual const char *GetData() { return ""; }
}
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 class ESP3DSensor {
{ public:
public: ESP3DSensor();
ESP3DSensor(); ~ESP3DSensor();
~ESP3DSensor(); bool begin();
bool begin(); void end();
void end(); void handle();
void handle(); bool setInterval(uint interval);
bool setInterval(uint interval); bool isModelValid(uint8_t model);
bool isModelValid(uint8_t model); const char *GetCurrentModelString();
const char * GetCurrentModelString(); uint8_t getIDFromString(const char *s);
uint8_t getIDFromString(const char *s); uint8_t nbType();
uint8_t nbType(); uint interval() { return _interval; }
uint interval() uint8_t GetModel(uint8_t i = 0);
{ const char *GetModelString(uint8_t i = 0);
return _interval; const char *GetData();
} bool started() { return _started; }
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;
};
protected:
bool _started;
uint32_t _interval;
uint32_t _lastReadTime;
ESP3DSensorDevice *_device;
};
extern ESP3DSensor esp3d_sensor; extern ESP3DSensor esp3d_sensor;
#endif //_ESP3D_SENSOR_H #endif //_ESP3D_SENSOR_H

View File

@ -294,8 +294,10 @@ void ESP3DSerialService::flushbuffer() {
// dispatch command // dispatch command
if (_started) { if (_started) {
ESP3DMessage *message = ESP3DMessageManager::newMsg( ESP3DMessage *message = ESP3DMessageManager::newMsg(
_origin, _id== MAIN_SERIAL?ESP3DClientType::all_clients: esp3d_commands.getOutputClient(), (uint8_t *)_buffer, _buffer_size, _origin,
getAuthentication()); _id == MAIN_SERIAL ? ESP3DClientType::all_clients
: esp3d_commands.getOutputClient(),
(uint8_t *)_buffer, _buffer_size, getAuthentication());
if (message) { if (message) {
// process command // process command
message->type = ESP3DMessageType::unique; message->type = ESP3DMessageType::unique;

View File

@ -23,8 +23,9 @@
#if defined(ESP3DLIB_ENV) && COMMUNICATION_PROTOCOL == SOCKET_SERIAL #if defined(ESP3DLIB_ENV) && COMMUNICATION_PROTOCOL == SOCKET_SERIAL
#include <Arduino.h> #include <Arduino.h>
#include "../../core/esp3d_message.h"
#include "../../core/esp3d_commands.h" #include "../../core/esp3d_commands.h"
#include "../../core/esp3d_message.h"
#include "serial2socket.h" #include "serial2socket.h"
Serial_2_Socket Serial2Socket; Serial_2_Socket Serial2Socket;
@ -167,8 +168,8 @@ void Serial_2_Socket::handle_flush() {
void Serial_2_Socket::flush(void) { void Serial_2_Socket::flush(void) {
if (_TXbufferSize > 0 && _started && !_paused) { if (_TXbufferSize > 0 && _started && !_paused) {
ESP3DMessage *msg = ESP3DMessageManager::newMsg( ESP3DMessage *msg = ESP3DMessageManager::newMsg(
ESP3DClientType::socket_serial, ESP3DClientType::all_clients, ESP3DClientType::socket_serial, ESP3DClientType::all_clients, _TXbuffer,
_TXbuffer, _TXbufferSize, _auth); _TXbufferSize, _auth);
// dispatch command // dispatch command
if (msg) { if (msg) {
// process command // process command
@ -186,7 +187,7 @@ void Serial_2_Socket::flush(void) {
bool Serial_2_Socket::dispatch(ESP3DMessage *message) { bool Serial_2_Socket::dispatch(ESP3DMessage *message) {
if (!message || !_started) { if (!message || !_started) {
esp3d_log_e("Serial2Socket: no message or not started"); esp3d_log_e("Serial2Socket: no message or not started");
return false; return false;
} }
if (message->size > 0 && message->data) { if (message->size > 0 && message->data) {

View File

@ -22,14 +22,13 @@
#define _SERIAL_2_SOCKET_H_ #define _SERIAL_2_SOCKET_H_
#include <Print.h> #include <Print.h>
#include "../authentication/authentication_level_types.h" #include "../authentication/authentication_level_types.h"
#define S2S_TXBUFFERSIZE 1200 #define S2S_TXBUFFERSIZE 1200
#define S2S_RXBUFFERSIZE 128 #define S2S_RXBUFFERSIZE 128
#define S2S_FLUSHTIMEOUT 500 #define S2S_FLUSHTIMEOUT 500
class ESP3DMessage; // forward declaration
class ESP3DMessage; // forward declaration
class Serial_2_Socket : public Stream { class Serial_2_Socket : public Stream {
public: public:

View File

@ -250,7 +250,8 @@ void TimeService::handle() {
isSet = true; isSet = true;
#if COMMUNICATION_PROTOCOL != MKS_SERIAL #if COMMUNICATION_PROTOCOL != MKS_SERIAL
#if defined(ESP_GOT_DATE_TIME_HOOK) && defined(GCODE_HOST_FEATURE) #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()); esp3d_gcode_host.processScript(dateMsg.c_str());
#endif // #if defined (ESP_GOT_IP_HOOK) && defined (GCODE_HOST_FEATURE) #endif // #if defined (ESP_GOT_IP_HOOK) && defined (GCODE_HOST_FEATURE)
#endif // #if COMMUNICATION_PROTOCOL == MKS_SERIAL #endif // #if COMMUNICATION_PROTOCOL == MKS_SERIAL

View File

@ -24,7 +24,6 @@
#include <Arduino.h> #include <Arduino.h>
#include <time.h> #include <time.h>
class TimeService { class TimeService {
public: public:
TimeService(); TimeService();

View File

@ -21,26 +21,27 @@
#ifndef _ESP_CONFIG_FILE_H #ifndef _ESP_CONFIG_FILE_H
#define _ESP_CONFIG_FILE_H #define _ESP_CONFIG_FILE_H
#include <Arduino.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 class ESP_ConfigFile {
{ public:
public: ESP_ConfigFile(const char *path, TProcessingFunction fn);
ESP_ConfigFile(const char * path, TProcessingFunction fn); ~ESP_ConfigFile();
~ESP_ConfigFile(); char *trimSpaces(char *line, uint8_t maxsize = 0);
char * trimSpaces(char * line, uint8_t maxsize=0); bool isComment(char *line);
bool isComment(char * line); bool isSection(char *line);
bool isSection(char * line); bool isValue(char *line);
bool isValue(char * line); char *getSectionName(char *line);
char * getSectionName(char * line); char *getKeyName(char *line);
char * getKeyName(char * line); char *getValue(char *line);
char * getValue(char * line); bool processFile();
bool processFile(); bool revokeFile();
bool revokeFile();
private: private:
bool isScrambleKey(const char *key, const char * str); bool isScrambleKey(const char *key, const char *str);
char * _filename; char *_filename;
TProcessingFunction _pfunction; TProcessingFunction _pfunction;
}; };
#endif //_ESP_CONFIG_FILE_H #endif //_ESP_CONFIG_FILE_H

View File

@ -288,7 +288,8 @@ bool processingFileFunction(const char* section, const char* key,
b = v; b = v;
} }
} }
// Notification type None / PushOver / Line / Email / Telegram / IFTTT / HomeAssistant // Notification type None / PushOver / Line / Email / Telegram / IFTTT /
// HomeAssistant
if (!done) { if (!done) {
if (strcasecmp("NOTIF_TYPE", key) == 0) { if (strcasecmp("NOTIF_TYPE", key) == 0) {
T = 'B'; T = 'B';

View File

@ -21,21 +21,18 @@
#ifndef _UPDATE_SERVICES_H #ifndef _UPDATE_SERVICES_H
#define _UPDATE_SERVICES_H #define _UPDATE_SERVICES_H
class UpdateService {
public:
UpdateService();
~UpdateService();
void handle();
bool begin();
void end();
class UpdateService private:
{ bool flash(const char* filename, int type);
public:
UpdateService();
~UpdateService();
void handle();
bool begin();
void end();
private:
bool flash(const char * filename, int type);
}; };
extern UpdateService update_service; extern UpdateService update_service;
#endif //_UPDATE_SERVICES_H #endif //_UPDATE_SERVICES_H

View File

@ -87,15 +87,15 @@ void WebdavServer::handler_copy(const char* url) {
} }
// check available space // check available space
#if WEBDAV_FEATURE == FS_ROOT #if WEBDAV_FEATURE == FS_ROOT
uint64_t free_space = WebDavFS::freeBytes(fsTypeDestination); uint64_t free_space = WebDavFS::freeBytes(fsTypeDestination);
#else #else
#if WEBDAV_FEATURE == FS_FLASH #if WEBDAV_FEATURE == FS_FLASH
size_t free_space; size_t free_space;
#endif #endif
#if WEBDAV_FEATURE == FS_SD #if WEBDAV_FEATURE == FS_SD
uint64_t free_space; uint64_t free_space;
#endif #endif
free_space = WebDavFS::freeBytes(); free_space = WebDavFS::freeBytes();
#endif #endif
if (overwrite) { if (overwrite) {
if (WebDavFS::exists(destination.c_str())) { if (WebDavFS::exists(destination.c_str())) {

View File

@ -59,15 +59,15 @@ void WebdavServer::handler_put(const char* url) {
if (!hasError) { if (!hasError) {
// check size available // check size available
#if WEBDAV_FEATURE == FS_ROOT #if WEBDAV_FEATURE == FS_ROOT
uint64_t free_space = WebDavFS::freeBytes(fsType); uint64_t free_space = WebDavFS::freeBytes(fsType);
#else #else
#if WEBDAV_FEATURE == FS_FLASH #if WEBDAV_FEATURE == FS_FLASH
size_t free_space; size_t free_space;
#endif #endif
#if WEBDAV_FEATURE == FS_SD #if WEBDAV_FEATURE == FS_SD
uint64_t free_space; uint64_t free_space;
#endif #endif
free_space = WebDavFS::freeBytes(); free_space = WebDavFS::freeBytes();
#endif #endif
if (free_space + file.size() < content_length) { if (free_space + file.size() < content_length) {
code = 507; code = 507;
@ -90,15 +90,15 @@ void WebdavServer::handler_put(const char* url) {
} else { } else {
// check size available // check size available
#if WEBDAV_FEATURE == FS_ROOT #if WEBDAV_FEATURE == FS_ROOT
uint64_t free_space = WebDavFS::freeBytes(fsType); uint64_t free_space = WebDavFS::freeBytes(fsType);
#else #else
#if WEBDAV_FEATURE == FS_FLASH #if WEBDAV_FEATURE == FS_FLASH
size_t free_space; size_t free_space;
#endif #endif
#if WEBDAV_FEATURE == FS_SD #if WEBDAV_FEATURE == FS_SD
uint64_t free_space; uint64_t free_space;
#endif #endif
free_space = WebDavFS::freeBytes(); free_space = WebDavFS::freeBytes();
#endif #endif
if (free_space < content_length) { if (free_space < content_length) {
code = 507; code = 507;

View File

@ -78,7 +78,7 @@ bool WebSocket_Server::pushMSG(uint num, const char *data) {
return false; return false;
} }
bool WebSocket_Server::isConnected(){ bool WebSocket_Server::isConnected() {
if (_websocket_server) { if (_websocket_server) {
return _websocket_server->connectedClients() > 0; 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 // need periodic check to force to flush in case of no end
for (uint i = 0; i < size; i++) { 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) { if (_TXbufferSize >= TXBUFFERSIZE) {
flushTXbuffer(); flushTXbuffer();
} }

View File

@ -140,7 +140,7 @@ bool WiFiConfig::StartSTA() {
WiFi.setMinSecurity(WIFI_AUTH_WEP); WiFi.setMinSecurity(WIFI_AUTH_WEP);
WiFi.setScanMethod(WIFI_ALL_CHANNEL_SCAN); WiFi.setScanMethod(WIFI_ALL_CHANNEL_SCAN);
WiFi.setSortMethod(WIFI_CONNECT_AP_BY_SIGNAL); 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); WiFi.setTxPower(ESP32_WIFI_TX_POWER);
delay(100); delay(100);
#endif // ESP32_WIFI_TX_POWER #endif // ESP32_WIFI_TX_POWER
@ -232,10 +232,10 @@ bool WiFiConfig::StartAP(bool setupMode) {
_ap_gateway = setupMode ? ip : gw; _ap_gateway = setupMode ? ip : gw;
_ap_subnet = mask; _ap_subnet = mask;
#endif // ARDUINO_ARCH_ESP8266 #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); WiFi.setTxPower(ESP32_WIFI_TX_POWER);
delay(100); delay(100);
#endif // ESP32_WIFI_TX_POWER #endif // ESP32_WIFI_TX_POWER
// Start AP // Start AP
if (WiFi.softAP(SSID.c_str(), if (WiFi.softAP(SSID.c_str(),

32
tools/format_sources.py Normal file
View 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}')