mirror of
https://git.mirrors.martin98.com/https://github.com/luc-github/ESP3D.git
synced 2025-08-13 05:29:03 +08:00
Add Script to parse all c/cpp/h/ino files and format them using clang-format with Google style
Update style to some files with clang-format using Google style Add Script to parse all embedded js/css files and format them using prettier based on .prettierrc config file Update style to embedded js/css files with prettier
This commit is contained in:
parent
9a597ca940
commit
ea1eb83a28
28
embedded/.prettierrc
Normal file
28
embedded/.prettierrc
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
{
|
||||||
|
"printWidth": 80,
|
||||||
|
"tabWidth": 4,
|
||||||
|
"useTabs": false,
|
||||||
|
"semi": true,
|
||||||
|
"singleQuote": true,
|
||||||
|
"jsxSingleQuote": false,
|
||||||
|
"trailingComma": "es5",
|
||||||
|
"bracketSpacing": true,
|
||||||
|
"bracketSameLine": false,
|
||||||
|
"arrowParens": "always",
|
||||||
|
"requirePragma": false,
|
||||||
|
"insertPragma": false,
|
||||||
|
"proseWrap": "preserve",
|
||||||
|
"overrides": [
|
||||||
|
{
|
||||||
|
"files": "*.js",
|
||||||
|
"options": {
|
||||||
|
"parser": "babel"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{"files": "*.scss",
|
||||||
|
"options": {
|
||||||
|
"parser": "css"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -1,85 +1,83 @@
|
|||||||
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 (index < data.length - 1) out += ',';
|
||||||
if (nb == 15) {
|
if (nb == 15) {
|
||||||
out += "\n ";
|
out += '\n ';
|
||||||
nb = 0;
|
nb = 0;
|
||||||
} else {
|
} else {
|
||||||
nb++;
|
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();
|
let bin2cfile = fs.readFileSync(distPath + 'out.tmp').toString();
|
||||||
fs.appendFileSync(distPath + "favicon.h", bin2cfile);
|
fs.appendFileSync(distPath + 'favicon.h', bin2cfile);
|
||||||
fs.appendFileSync(
|
fs.appendFileSync(
|
||||||
distPath + "favicon.h",
|
distPath + 'favicon.h',
|
||||||
fs.readFileSync(srcPath + "footer.txt")
|
fs.readFileSync(srcPath + 'footer.txt')
|
||||||
);
|
);
|
||||||
|
|
||||||
//Check format result
|
//Check format result
|
||||||
if (fs.existsSync(distPath + "favicon.h")) {
|
if (fs.existsSync(distPath + 'favicon.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 + "favicon.h"));
|
fs.writeFileSync(headerPath, fs.readFileSync(distPath + 'favicon.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;
|
||||||
}
|
}
|
||||||
|
};
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Create a gzip function for reusable purpose
|
// Create a gzip function for reusable purpose
|
||||||
const compressFile = (filePath, targetPath) => {
|
const compressFile = (filePath, targetPath) => {
|
||||||
@ -87,9 +85,10 @@ const compressFile = (filePath, targetPath) => {
|
|||||||
stream
|
stream
|
||||||
.pipe(createGzip(targetPath))
|
.pipe(createGzip(targetPath))
|
||||||
.pipe(createWriteStream(targetPath))
|
.pipe(createWriteStream(targetPath))
|
||||||
.on("finish", () =>{console.log(`Successfully compressed at ${targetPath}`);
|
.on('finish', () => {
|
||||||
convertToC (targetPath)}
|
console.log(`Successfully compressed at ${targetPath}`);
|
||||||
);
|
convertToC(targetPath);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
compressFile(srcPath + "favicon.ico", distPath + "favicon.ico.gz");
|
compressFile(srcPath + 'favicon.ico', distPath + 'favicon.ico.gz');
|
||||||
|
@ -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 (index < data.length - 1) out += ',';
|
||||||
if (nb == 15) {
|
if (nb == 15) {
|
||||||
out += "\n ";
|
out += '\n ';
|
||||||
nb = 0;
|
nb = 0;
|
||||||
} else {
|
} else {
|
||||||
nb++;
|
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;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
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) => {
|
||||||
@ -9,7 +9,8 @@ const compressFile = (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
@ -1,31 +1,31 @@
|
|||||||
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: {
|
devServer: {
|
||||||
historyApiFallback: true, // to make our SPA works after a full reload, so that it serves 'index.html' when 404 response
|
historyApiFallback: true, // to make our SPA works after a full reload, so that it serves 'index.html' when 404 response
|
||||||
open: true,
|
open: true,
|
||||||
static: {
|
static: {
|
||||||
directory: path.resolve(__dirname, "./dist"),
|
directory: path.resolve(__dirname, './dist'),
|
||||||
},
|
},
|
||||||
port: 8088,
|
port: 8088,
|
||||||
proxy: {
|
proxy: {
|
||||||
context: () => true,
|
context: () => true,
|
||||||
target: "http://localhost:8080",
|
target: 'http://localhost:8080',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
stats: "minimal", // default behaviour spit out way too much info. adjust to your need.
|
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
|
devtool: 'source-map', // a sourcemap type. map to original source with line number
|
||||||
plugins: [
|
plugins: [
|
||||||
new HtmlWebpackPlugin({
|
new HtmlWebpackPlugin({
|
||||||
template: path.join(__dirname, "../src/index.html"),
|
template: path.join(__dirname, '../src/index.html'),
|
||||||
inlineSource: ".(js|css)$",
|
inlineSource: '.(js|css)$',
|
||||||
inject: true,
|
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
|
], // 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
|
||||||
@ -35,9 +35,9 @@ module.exports = {
|
|||||||
test: /\.js$/,
|
test: /\.js$/,
|
||||||
exclude: /(node_modules)/,
|
exclude: /(node_modules)/,
|
||||||
use: {
|
use: {
|
||||||
loader: "babel-loader",
|
loader: 'babel-loader',
|
||||||
options: {
|
options: {
|
||||||
presets: ["@babel/preset-env"],
|
presets: ['@babel/preset-env'],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -46,7 +46,7 @@ module.exports = {
|
|||||||
// this are the loaders. they interpret files, in this case css. they run from right to left sequence.
|
// 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."
|
// 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.
|
// style-loader: "Adds CSS to the DOM by injecting a <style> tag". this is fine for development.
|
||||||
use: ["style-loader", "css-loader"],
|
use: ['style-loader', 'css-loader'],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
@ -1,41 +1,41 @@
|
|||||||
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' },
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
@ -49,13 +49,13 @@ module.exports = {
|
|||||||
// always deletes the dist folder first in each build run.
|
// always deletes the dist folder first in each build run.
|
||||||
new CleanWebpackPlugin(),
|
new CleanWebpackPlugin(),
|
||||||
new MiniCssExtractPlugin({
|
new MiniCssExtractPlugin({
|
||||||
filename: "[name].css",
|
filename: '[name].css',
|
||||||
chunkFilename: "[id].css",
|
chunkFilename: '[id].css',
|
||||||
}),
|
}),
|
||||||
new HtmlWebpackPlugin({
|
new HtmlWebpackPlugin({
|
||||||
template: path.join(__dirname, "../src/index.html"),
|
template: path.join(__dirname, '../src/index.html'),
|
||||||
inlineSource: ".(js|css)$",
|
inlineSource: '.(js|css)$',
|
||||||
inject: "body",
|
inject: 'body',
|
||||||
}),
|
}),
|
||||||
|
|
||||||
new HtmlInlineScriptPlugin({
|
new HtmlInlineScriptPlugin({
|
||||||
@ -65,10 +65,10 @@ module.exports = {
|
|||||||
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: {
|
optimization: {
|
||||||
@ -81,7 +81,7 @@ module.exports = {
|
|||||||
minifyJS: true,
|
minifyJS: true,
|
||||||
},
|
},
|
||||||
minify: (data, minimizerOptions) => {
|
minify: (data, minimizerOptions) => {
|
||||||
const htmlMinifier = require("html-minifier-terser");
|
const htmlMinifier = require('html-minifier-terser');
|
||||||
const [[filename, input]] = Object.entries(data);
|
const [[filename, input]] = Object.entries(data);
|
||||||
|
|
||||||
return htmlMinifier.minify(input, minimizerOptions);
|
return htmlMinifier.minify(input, minimizerOptions);
|
||||||
@ -89,5 +89,5 @@ module.exports = {
|
|||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
devtool: "source-map", // supposedly the ideal type without bloating bundle size
|
devtool: 'source-map', // supposedly the ideal type without bloating bundle size
|
||||||
};
|
};
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,14 +1,17 @@
|
|||||||
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');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,9 +209,9 @@ li {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.text-error-login {
|
.text-error-login {
|
||||||
background-color: white;
|
background-color: white;
|
||||||
color: red;
|
color: red;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.disabled {
|
.disabled {
|
||||||
@ -336,7 +336,7 @@ li:hover {
|
|||||||
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;
|
||||||
}
|
}
|
||||||
|
63
embedded/tools/format_sources.py
Normal file
63
embedded/tools/format_sources.py
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
from shutil import which
|
||||||
|
|
||||||
|
def format_sources():
|
||||||
|
"""
|
||||||
|
Format JavaScript and CSS files using Prettier.
|
||||||
|
|
||||||
|
This script locates all JavaScript and CSS files in the 'src' and 'config' directories
|
||||||
|
(including subdirectories) and formats them using the Prettier tool. It requires Node.js
|
||||||
|
and the Prettier package to be installed.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
None
|
||||||
|
"""
|
||||||
|
# Base directory of the script
|
||||||
|
script_path = os.path.abspath(__file__)
|
||||||
|
|
||||||
|
# Extract dir path
|
||||||
|
script_dir = os.path.dirname(script_path)
|
||||||
|
|
||||||
|
# Build paths of sources dirs: ../src and ../config
|
||||||
|
src_dir = os.path.abspath(os.path.normpath(os.path.join(script_dir, '..', 'src')))
|
||||||
|
config_dir = os.path.abspath(os.path.normpath(os.path.join(script_dir, '..', 'config')))
|
||||||
|
|
||||||
|
# Parse all c, h , cpp, js, css files in all directories and sub directories
|
||||||
|
file_paths = []
|
||||||
|
for base_dir in [src_dir, config_dir]:
|
||||||
|
for root, dirs, files in os.walk(base_dir):
|
||||||
|
for file in files:
|
||||||
|
if file.endswith(('.js', '.css')):
|
||||||
|
file_path = os.path.join(root, file)
|
||||||
|
file_paths.append(os.path.abspath(os.path.normpath(file_path)))
|
||||||
|
print(os.path.abspath(os.path.normpath(file_path)))
|
||||||
|
|
||||||
|
# Locate the Prettier binary
|
||||||
|
node_path = which('node')
|
||||||
|
print(node_path)
|
||||||
|
if not node_path:
|
||||||
|
print("node not found in PATH. Please install it globally or locally.")
|
||||||
|
exit(1)
|
||||||
|
node_dir = os.path.dirname(node_path)
|
||||||
|
client_path = os.path.join('node_modules', 'npm', 'bin', 'npx-cli.js')
|
||||||
|
print(client_path)
|
||||||
|
|
||||||
|
# Now format all files one by one with prettier
|
||||||
|
prettierrc_path = os.path.abspath(os.path.normpath(os.path.join(script_dir, '..', '.prettierrc')))
|
||||||
|
print("Using:" + prettierrc_path)
|
||||||
|
for file_path in file_paths:
|
||||||
|
tmpPath = file_path
|
||||||
|
print("Formating " + tmpPath)
|
||||||
|
try:
|
||||||
|
command = ['node', client_path, 'prettier', '--write', tmpPath]
|
||||||
|
print(command)
|
||||||
|
subprocess.run(command, check=False, cwd=node_dir)
|
||||||
|
print("=> Ok")
|
||||||
|
except subprocess.CalledProcessError as e:
|
||||||
|
print(f'=>Error : {e}')
|
||||||
|
|
||||||
|
# Call the format_sources function
|
||||||
|
format_sources()
|
@ -42,12 +42,12 @@
|
|||||||
* 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
|
||||||
|
|
||||||
/************************************
|
/************************************
|
||||||
*
|
*
|
||||||
@ -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
|
||||||
|
|
||||||
|
@ -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();
|
|
||||||
}
|
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
@ -48,9 +48,9 @@ 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())) {
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
@ -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";
|
||||||
|
@ -43,7 +43,8 @@ void ESP3DCommands::ESP610(int cmd_params_pos, ESP3DMessage* msg) {
|
|||||||
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,
|
||||||
|
@ -20,10 +20,9 @@
|
|||||||
|
|
||||||
#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;
|
||||||
@ -47,14 +46,15 @@ void report_esp3d(const char * format, ...)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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,
|
||||||
|
bench_transfered, bench_end - bench_start, rate);
|
||||||
} else {
|
} else {
|
||||||
report_esp3d("REPORT: %s %llu bytes in %llu ms, %.2f Kbytes/s", title, bench_transfered, bench_end - bench_start, rate/1024);
|
report_esp3d("REPORT: %s %llu bytes in %llu ms, %.2f Kbytes/s", title,
|
||||||
|
bench_transfered, bench_end - bench_start, rate / 1024);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif //ESP_BENCHMARK_FEATURE
|
#endif // ESP_BENCHMARK_FEATURE
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#ifndef _BENCHMARK_ESP3D_H
|
#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);
|
||||||
|
extern void report_esp3d(const char* format, ...);
|
||||||
#endif //_BENCHMARK_ESP3D_H
|
#endif //_BENCHMARK_ESP3D_H
|
||||||
|
@ -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);
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
#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>
|
||||||
|
@ -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:
|
||||||
|
@ -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
|
||||||
|
@ -21,63 +21,35 @@
|
|||||||
*/
|
*/
|
||||||
#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:
|
||||||
class CardReader
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static card_flags_t flag; // Flags (above)
|
static card_flags_t flag; // Flags (above)
|
||||||
static void mount();
|
static void mount();
|
||||||
static void release();
|
static void release();
|
||||||
static bool isMounted()
|
static bool isMounted() { return flag.mounted; }
|
||||||
{
|
|
||||||
return flag.mounted;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void abortFilePrintSoon()
|
static void abortFilePrintSoon() { flag.abort_sd_printing = isFileOpen(); }
|
||||||
{
|
static void pauseSDPrint() { flag.sdprinting = false; }
|
||||||
flag.abort_sd_printing = isFileOpen();
|
static bool isPrinting() { return flag.sdprinting; }
|
||||||
}
|
static bool isPaused() { return isFileOpen() && !isPrinting(); }
|
||||||
static void pauseSDPrint()
|
static bool isFileOpen() { return isMounted() && isPrinting(); }
|
||||||
{
|
|
||||||
flag.sdprinting = false;
|
|
||||||
}
|
|
||||||
static bool isPrinting()
|
|
||||||
{
|
|
||||||
return flag.sdprinting;
|
|
||||||
}
|
|
||||||
static bool isPaused()
|
|
||||||
{
|
|
||||||
return isFileOpen() && !isPrinting();
|
|
||||||
}
|
|
||||||
static bool isFileOpen()
|
|
||||||
{
|
|
||||||
return isMounted() && isPrinting();
|
|
||||||
}
|
|
||||||
private:
|
|
||||||
|
|
||||||
|
private:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#define IS_SD_PRINTING() (card.flag.sdprinting && !card.flag.abort_sd_printing)
|
#define IS_SD_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()
|
||||||
|
@ -41,8 +41,12 @@ 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
|
||||||
|
// chinese
|
||||||
|
#define ESP_STA_PASSWORD \
|
||||||
|
34 // 65 bytes 64 +1 = string ;warning does not support multibyte char like
|
||||||
|
// chinese
|
||||||
#define ESP_STA_IP_MODE 99 // 1 byte = flag
|
#define ESP_STA_IP_MODE 99 // 1 byte = flag
|
||||||
#define ESP_STA_IP_VALUE 100 // 4 bytes xxx.xxx.xxx.xxx
|
#define ESP_STA_IP_VALUE 100 // 4 bytes xxx.xxx.xxx.xxx
|
||||||
#define ESP_STA_MASK_VALUE 104 // 4 bytes xxx.xxx.xxx.xxx
|
#define ESP_STA_MASK_VALUE 104 // 4 bytes xxx.xxx.xxx.xxx
|
||||||
@ -56,13 +60,23 @@ typedef uint ESP3DSettingIndex;
|
|||||||
#define ESP_HTTP_PORT 121 // 4 bytes = int
|
#define ESP_HTTP_PORT 121 // 4 bytes = int
|
||||||
#define ESP_TELNET_PORT 125 // 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 \
|
||||||
|
130 // 33 bytes 32+1 = string ; warning does not support multibyte char like
|
||||||
|
// chinese
|
||||||
#define ESP_SENSOR_INTERVAL 164 // 4 bytes = int
|
#define ESP_SENSOR_INTERVAL 164 // 4 bytes = int
|
||||||
#define ESP_SETTINGS_VERSION 168 // 8 bytes = 7+1 = string ESP3D + 2 digits
|
#define ESP_SETTINGS_VERSION 168 // 8 bytes = 7+1 = string ESP3D + 2 digits
|
||||||
#define ESP_ADMIN_PWD 176 // 21 bytes 20+1 = string ; warning does not support multibyte char like chinese
|
#define ESP_ADMIN_PWD \
|
||||||
#define ESP_USER_PWD 197 // 21 bytes 20+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_SSID 218 // 33 bytes 32+1 = string ; warning does not support multibyte char like chinese
|
// like chinese
|
||||||
#define ESP_AP_PASSWORD 251 // 65 bytes 64 +1 = string ;warning does not support multibyte char like chinese
|
#define ESP_USER_PWD \
|
||||||
|
197 // 21 bytes 20+1 = string ; warning does not support multibyte char
|
||||||
|
// like chinese
|
||||||
|
#define ESP_AP_SSID \
|
||||||
|
218 // 33 bytes 32+1 = string ; warning does not support multibyte char like
|
||||||
|
// chinese
|
||||||
|
#define ESP_AP_PASSWORD \
|
||||||
|
251 // 65 bytes 64 +1 = string ;warning does not support multibyte char like
|
||||||
|
// chinese
|
||||||
#define ESP_AP_IP_VALUE 316 // 4 bytes xxx.xxx.xxx.xxx
|
#define ESP_AP_IP_VALUE 316 // 4 bytes xxx.xxx.xxx.xxx
|
||||||
#define ESP_BOOT_DELAY 320 // 4 bytes = int
|
#define ESP_BOOT_DELAY 320 // 4 bytes = int
|
||||||
#define ESP_WEBSOCKET_PORT 324 // 4 bytes= int
|
#define ESP_WEBSOCKET_PORT 324 // 4 bytes= int
|
||||||
@ -70,21 +84,33 @@ typedef uint ESP3DSettingIndex;
|
|||||||
#define ESP_TELNET_ON 329 // 1 byte = flag
|
#define ESP_TELNET_ON 329 // 1 byte = flag
|
||||||
#define ESP_WEBSOCKET_ON 330 // 1 byte = flag
|
#define ESP_WEBSOCKET_ON 330 // 1 byte = flag
|
||||||
#define ESP_SD_SPEED_DIV 331 // 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_TOKEN1 \
|
||||||
#define ESP_NOTIFICATION_TOKEN2 583 // 64 bytes 63+1 = string ; warning does not support multibyte char like chinese
|
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_SENSOR_TYPE 647 // 1 bytes = flag
|
||||||
#define ESP_TARGET_FW 648 // 1 bytes = flag
|
#define ESP_TARGET_FW 648 // 1 bytes = flag
|
||||||
#define ESP_FREE 649 // 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 \
|
||||||
|
1043 // 129 bytes 128+1 = string ; warning does not support multibyte char
|
||||||
|
// like chinese
|
||||||
#define ESP_CALIBRATION_1 1172 // 4 bytes = int
|
#define ESP_CALIBRATION_1 1172 // 4 bytes = int
|
||||||
#define ESP_CALIBRATION_2 1176 // 4 bytes = int
|
#define ESP_CALIBRATION_2 1176 // 4 bytes = int
|
||||||
#define ESP_CALIBRATION_3 1180 // 4 bytes = int
|
#define ESP_CALIBRATION_3 1180 // 4 bytes = int
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
@ -25,34 +25,30 @@ 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()
|
bool started() { return _started; }
|
||||||
{
|
|
||||||
return _started;
|
|
||||||
}
|
|
||||||
bool begin();
|
bool begin();
|
||||||
void end();
|
void end();
|
||||||
void handle();
|
void handle();
|
||||||
tone_data * getNextTone();
|
tone_data* getNextTone();
|
||||||
bool isPlaying();
|
bool isPlaying();
|
||||||
void waitWhilePlaying();
|
void waitWhilePlaying();
|
||||||
void beep(int count=1, int delay = 0, int frequency = BEEP_FREQUENCY);
|
void beep(int count = 1, int delay = 0, int frequency = BEEP_FREQUENCY);
|
||||||
private:
|
|
||||||
tone_data * _head;
|
private:
|
||||||
tone_data * _tail;
|
tone_data* _head;
|
||||||
|
tone_data* _tail;
|
||||||
bool _started;
|
bool _started;
|
||||||
void purgeData();
|
void purgeData();
|
||||||
bool addToneToList(int frequency, int duration);
|
bool addToneToList(int frequency, int duration);
|
||||||
void no_tone();
|
void no_tone();
|
||||||
|
|
||||||
};
|
};
|
||||||
extern BuzzerDevice esp3d_buzzer;
|
extern BuzzerDevice esp3d_buzzer;
|
||||||
#endif //_BUZZER_H
|
#endif //_BUZZER_H
|
||||||
|
@ -18,35 +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
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#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, const char* filename=NULL);
|
bool handle_snap(WebServer *webserver, const char *path = 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()
|
|
||||||
{
|
|
||||||
return _initialised;
|
|
||||||
}
|
|
||||||
private:
|
|
||||||
bool _initialised;
|
bool _initialised;
|
||||||
bool _started;
|
bool _started;
|
||||||
};
|
};
|
||||||
@ -54,4 +47,3 @@ private:
|
|||||||
extern Camera esp3d_camera;
|
extern Camera esp3d_camera;
|
||||||
|
|
||||||
#endif //_CAMERA_H
|
#endif //_CAMERA_H
|
||||||
|
|
||||||
|
@ -18,21 +18,17 @@
|
|||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
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 {
|
||||||
class DevicesServices
|
public:
|
||||||
{
|
|
||||||
public:
|
|
||||||
static bool begin();
|
static bool begin();
|
||||||
static void end();
|
static void end();
|
||||||
static void handle();
|
static void handle();
|
||||||
private:
|
|
||||||
|
private:
|
||||||
static bool _started;
|
static bool _started;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //_DEVICES_SERVICES_H
|
#endif //_DEVICES_SERVICES_H
|
||||||
|
|
||||||
|
@ -18,10 +18,10 @@
|
|||||||
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
|
||||||
@ -33,19 +33,19 @@
|
|||||||
#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
|
||||||
|
@ -18,10 +18,10 @@
|
|||||||
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
|
||||||
@ -33,19 +33,19 @@
|
|||||||
#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
|
||||||
|
@ -18,11 +18,11 @@
|
|||||||
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
|
||||||
@ -34,19 +34,19 @@
|
|||||||
#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
|
||||||
|
@ -18,11 +18,11 @@
|
|||||||
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
|
||||||
@ -34,19 +34,19 @@
|
|||||||
#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
|
||||||
|
@ -18,52 +18,47 @@
|
|||||||
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)
|
static void setConnected(bool connected) { _connected = connected; }
|
||||||
{
|
|
||||||
_connected = connected;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool linkUp();
|
static bool linkUp();
|
||||||
private :
|
|
||||||
|
private:
|
||||||
static bool _started;
|
static bool _started;
|
||||||
static bool _connected;
|
static bool _connected;
|
||||||
};
|
};
|
||||||
|
@ -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
|
||||||
|
@ -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];
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
@ -32,9 +32,8 @@ 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;
|
||||||
}
|
}
|
||||||
@ -42,21 +41,18 @@ inline Print &operator <<(Print &stream, T arg)
|
|||||||
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;
|
||||||
}
|
}
|
||||||
@ -77,8 +73,7 @@ inline Print &operator <<(Print &obj, const _BYTE_CODE &arg)
|
|||||||
// 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;
|
||||||
}
|
}
|
||||||
@ -93,12 +88,10 @@ inline Print &operator <<(Print &obj, const _BASED &arg)
|
|||||||
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;
|
||||||
}
|
}
|
||||||
@ -118,10 +111,9 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,9 +18,9 @@
|
|||||||
* 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
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
** **
|
** **
|
||||||
@ -38,73 +38,67 @@ class WiFiClient;
|
|||||||
#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_Stop = 0, // In this stage, stop any connection
|
||||||
FTP_Init, // initialize some variables
|
FTP_Init, // initialize some variables
|
||||||
FTP_Client, // wait for client connection
|
FTP_Client, // wait for client connection
|
||||||
FTP_User, // wait for user name
|
FTP_User, // wait for user name
|
||||||
FTP_Pass, // wait for user password
|
FTP_Pass, // wait for user password
|
||||||
FTP_Cmd
|
FTP_Cmd
|
||||||
}; // answers to commands
|
}; // answers to commands
|
||||||
|
|
||||||
enum ftpTransfer { FTP_Close = 0, // In this stage, close data channel
|
enum ftpTransfer {
|
||||||
|
FTP_Close = 0, // In this stage, close data channel
|
||||||
FTP_Retrieve, // retrieve file
|
FTP_Retrieve, // retrieve file
|
||||||
FTP_Store, // store file
|
FTP_Store, // store file
|
||||||
FTP_List, // list of files
|
FTP_List, // list of files
|
||||||
FTP_Nlst, // list of name of files
|
FTP_Nlst, // list of name of files
|
||||||
FTP_Mlsd
|
FTP_Mlsd
|
||||||
}; // listing for machine processing
|
}; // listing for machine processing
|
||||||
|
|
||||||
enum ftpDataConn { FTP_NoConn = 0,// No data connexion
|
enum ftpDataConn {
|
||||||
|
FTP_NoConn = 0, // No data connexion
|
||||||
FTP_Pasive, // Pasive type
|
FTP_Pasive, // Pasive type
|
||||||
FTP_Active
|
FTP_Active
|
||||||
}; // Active type
|
}; // 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()
|
uint16_t ctrlport() { return ctrlPort; }
|
||||||
{
|
uint16_t datapassiveport() { return passivePort; }
|
||||||
return ctrlPort;
|
uint16_t dataactiveport() { return activePort; }
|
||||||
}
|
|
||||||
uint16_t datapassiveport()
|
|
||||||
{
|
|
||||||
return passivePort;
|
|
||||||
}
|
|
||||||
uint16_t dataactiveport()
|
|
||||||
{
|
|
||||||
return activePort;
|
|
||||||
}
|
|
||||||
void closeClient();
|
void closeClient();
|
||||||
bool isConnected();
|
bool isConnected();
|
||||||
const char* clientIPAddress();
|
const char* clientIPAddress();
|
||||||
bool isUser(const char * user);
|
bool isUser(const char* user);
|
||||||
bool isPassword(const char * password);
|
bool isPassword(const char* password);
|
||||||
bool accessFS(const char* path);
|
bool accessFS(const char* path);
|
||||||
void releaseFS();
|
void releaseFS();
|
||||||
private:
|
|
||||||
|
private:
|
||||||
void iniVariables();
|
void iniVariables();
|
||||||
void clientConnected();
|
void clientConnected();
|
||||||
void disconnectClient();
|
void disconnectClient();
|
||||||
bool processCommand();
|
bool processCommand();
|
||||||
bool haveParameter();
|
bool haveParameter();
|
||||||
int dataConnect( bool out150 = true );
|
int dataConnect(bool out150 = true);
|
||||||
bool dataConnected();
|
bool dataConnected();
|
||||||
bool doRetrieve();
|
bool doRetrieve();
|
||||||
bool doStore();
|
bool doStore();
|
||||||
@ -112,19 +106,20 @@ private:
|
|||||||
bool doMlsd();
|
bool doMlsd();
|
||||||
void closeTransfer();
|
void closeTransfer();
|
||||||
void abortTransfer();
|
void abortTransfer();
|
||||||
bool makePath( char * fullName, char * param = NULL );
|
bool makePath(char* fullName, char* param = NULL);
|
||||||
bool makeExistsPath( char * path, char * param = NULL );
|
bool makeExistsPath(char* path, char* param = NULL);
|
||||||
char * makeDateTimeStr( char * tstr, time_t timefile );
|
char* makeDateTimeStr(char* tstr, time_t timefile);
|
||||||
char * makeDateTimeString( 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 getDateTime(char* dt, uint16_t* pyear, uint8_t* pmonth, uint8_t* pday,
|
||||||
uint8_t * phour, uint8_t * pminute, uint8_t * second );
|
uint8_t* phour, uint8_t* pminute, uint8_t* second);
|
||||||
|
|
||||||
bool getFileModTime(const char * path,time_t & time);
|
bool getFileModTime(const char* path, time_t& time);
|
||||||
bool timeStamp( const char * path, uint16_t year, uint8_t month, uint8_t day, uint8_t hour, uint8_t minute, uint8_t second );
|
bool timeStamp(const char* path, uint16_t year, uint8_t month, uint8_t day,
|
||||||
|
uint8_t hour, uint8_t minute, uint8_t second);
|
||||||
int8_t readChar();
|
int8_t readChar();
|
||||||
uint8_t _fsType;
|
uint8_t _fsType;
|
||||||
FTP_SERVER * ftpServer;
|
FTP_SERVER* ftpServer;
|
||||||
FTP_SERVER * dataServer;
|
FTP_SERVER* dataServer;
|
||||||
uint16_t ctrlPort; // Command port on wich server is listening
|
uint16_t ctrlPort; // Command port on wich server is listening
|
||||||
uint16_t activePort; // Default data port in active mode
|
uint16_t activePort; // Default data port in active mode
|
||||||
uint16_t passivePort; // Data port in passive mode
|
uint16_t passivePort; // Data port in passive mode
|
||||||
@ -138,14 +133,15 @@ private:
|
|||||||
ftpTransfer transferStage; // stage of data connexion
|
ftpTransfer transferStage; // stage of data connexion
|
||||||
ftpDataConn dataConn; // type of data connexion
|
ftpDataConn dataConn; // type of data connexion
|
||||||
|
|
||||||
// uint8_t __attribute__((packed, aligned(4))) // need to be aligned to 32bit for Esp8266 SPIClass::transferBytes()
|
// uint8_t __attribute__((packed, aligned(4))) // need to be aligned to 32bit
|
||||||
uint8_t buf[ FTP_BUF_SIZE ]; // data buffer for transfers
|
// for Esp8266 SPIClass::transferBytes()
|
||||||
char cmdLine[ FTP_CMD_SIZE ]; // where to store incoming char from client
|
uint8_t buf[FTP_BUF_SIZE]; // data buffer for transfers
|
||||||
char cwdName[ FTP_CWD_SIZE ]; // name of current directory
|
char cmdLine[FTP_CMD_SIZE]; // where to store incoming char from client
|
||||||
char rnfrName[ FTP_CWD_SIZE ]; // name of file for RNFR command
|
char cwdName[FTP_CWD_SIZE]; // name of current directory
|
||||||
char command[ 5 ]; // command sent by client
|
char rnfrName[FTP_CWD_SIZE]; // name of file for RNFR command
|
||||||
|
char command[5]; // command sent by client
|
||||||
bool rnfrCmd; // previous command was RNFR
|
bool rnfrCmd; // previous command was RNFR
|
||||||
char * parameter; // point to begin of parameters sent by client
|
char* parameter; // point to begin of parameters sent by client
|
||||||
uint16_t dataPort;
|
uint16_t dataPort;
|
||||||
uint16_t iCL; // pointer to cmdLine next incoming char
|
uint16_t iCL; // pointer to cmdLine next incoming char
|
||||||
uint16_t nbMatch;
|
uint16_t nbMatch;
|
||||||
|
@ -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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -22,27 +22,33 @@
|
|||||||
#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,
|
0x91, 0x4e, 0x52, 0x3a, 0x44, 0x10, 0x27, 0x31, 0x45, 0xdc, 0xec, 0xd4,
|
||||||
0x80, 0xbf, 0xa0, 0x63, 0x56, 0x1d, 0x1d, 0x9c, 0xa4, 0x74, 0x15, 0x1c, 0xc4, 0x4d, 0x90, 0x0e,
|
0xdf, 0x21, 0x99, 0x44, 0x1c, 0x44, 0x74, 0x17, 0x9c, 0x8a, 0x73, 0x7f,
|
||||||
0x52, 0xa5, 0x9e, 0x4b, 0x4f, 0xf0, 0x52, 0x13, 0xa8, 0x82, 0x2f, 0x7c, 0xcd, 0xcb, 0xb9, 0xe7,
|
0x80, 0xbf, 0xa0, 0x63, 0x56, 0x1d, 0x1d, 0x9c, 0xa4, 0x74, 0x15, 0x1c,
|
||||||
0xde, 0x77, 0xf3, 0x5e, 0x5b, 0xa0, 0xc4, 0x2b, 0x0c, 0xc1, 0xcf, 0x26, 0x0e, 0xcb, 0x40, 0x1d,
|
0xc4, 0x4d, 0x90, 0x0e, 0x52, 0xa5, 0x9e, 0x4b, 0x4f, 0xf0, 0x52, 0x13,
|
||||||
0xc0, 0x26, 0xa1, 0x44, 0x65, 0xaa, 0xff, 0xd7, 0x78, 0x3b, 0x5f, 0x9e, 0x18, 0x79, 0xf3, 0x79,
|
0xa8, 0x82, 0x2f, 0x7c, 0xcd, 0xcb, 0xb9, 0xe7, 0xde, 0x77, 0xf3, 0x5e,
|
||||||
0x7d, 0x36, 0xbc, 0x2f, 0xbb, 0xc7, 0x71, 0xdc, 0x36, 0xf2, 0x62, 0xbe, 0x4e, 0x51, 0x5d, 0xd5,
|
0x5b, 0xa0, 0xc4, 0x2b, 0x0c, 0xc1, 0xcf, 0x26, 0x0e, 0xcb, 0x40, 0x1d,
|
||||||
0x18, 0x93, 0xd5, 0xbc, 0xde, 0xbc, 0x36, 0xdb, 0xb3, 0x72, 0xaf, 0xa5, 0x05, 0xbf, 0x59, 0x9f,
|
0xc0, 0x26, 0xa1, 0x44, 0x65, 0xaa, 0xff, 0xd7, 0x78, 0x3b, 0x5f, 0x9e,
|
||||||
0x79, 0x4f, 0x4e, 0x0f, 0xf8, 0x9c, 0x14, 0xf5, 0x39, 0x3b, 0xe8, 0xdd, 0x25, 0xef, 0xc4, 0xea,
|
0x18, 0x79, 0xf3, 0x79, 0x7d, 0x36, 0xbc, 0x2f, 0xbb, 0xc7, 0x71, 0xdc,
|
||||||
0xbc, 0x88, 0x89, 0xb4, 0xbd, 0xa2, 0x73, 0x60, 0x2c, 0x22, 0x3d, 0xd2, 0x20, 0x2d, 0x92, 0x92,
|
0x36, 0xf2, 0x62, 0xbe, 0x4e, 0x51, 0x5d, 0xd5, 0x18, 0x93, 0xd5, 0xbc,
|
||||||
0x91, 0x48, 0xa5, 0x35, 0xe4, 0x89, 0x72, 0xf2, 0x13, 0xb7, 0xe6, 0x01, 0xa5, 0x8a, 0x0b, 0x57,
|
0xde, 0xbc, 0x36, 0xdb, 0xb3, 0x72, 0xaf, 0xa5, 0x05, 0xbf, 0x59, 0x9f,
|
||||||
0x4c, 0x73, 0xbd, 0x24, 0x2e, 0xaf, 0x4a, 0x3a, 0x9c, 0x96, 0x79, 0xef, 0x92, 0x4f, 0x79, 0x6c,
|
0x79, 0x4f, 0x4e, 0x0f, 0xf8, 0x9c, 0x14, 0xf5, 0x39, 0x3b, 0xe8, 0xdd,
|
||||||
0xdd, 0x7b, 0x31, 0x92, 0x66, 0xb1, 0xae, 0xbc, 0x1d, 0xe5, 0x9e, 0x29, 0xd6, 0x27, 0x21, 0xd9,
|
0x25, 0xef, 0xc4, 0xea, 0xbc, 0x88, 0x89, 0xb4, 0xbd, 0xa2, 0x73, 0x60,
|
||||||
0xb1, 0x7d, 0x77, 0x6b, 0x65, 0x3d, 0x99, 0xb6, 0x2d, 0x4f, 0x5f, 0xba, 0xe5, 0xae, 0x93, 0x81,
|
0x2c, 0x22, 0x3d, 0xd2, 0x20, 0x2d, 0x92, 0x92, 0x91, 0x48, 0xa5, 0x35,
|
||||||
0x9e, 0x9f, 0xc9, 0x09, 0x59, 0x53, 0x6f, 0x35, 0x43, 0xf3, 0x3a, 0x39, 0x75, 0x75, 0x1f, 0x2c,
|
0xe4, 0x89, 0x72, 0xf2, 0x13, 0xb7, 0xe6, 0x01, 0xa5, 0x8a, 0x0b, 0x57,
|
||||||
0xd7, 0xf9, 0x7a, 0xfa, 0xae, 0x64, 0x7d, 0x0e, 0xb4, 0x6f, 0xa9, 0xe6, 0xd9, 0x7b, 0x8d, 0xe5,
|
0x4c, 0x73, 0xbd, 0x24, 0x2e, 0xaf, 0x4a, 0x3a, 0x9c, 0x96, 0x79, 0xef,
|
||||||
0xad, 0x15, 0x9c, 0xc1, 0x15, 0x19, 0x3a, 0x7f, 0x56, 0x6f, 0xa8, 0xd8, 0x8f, 0xbd, 0x2f, 0x38,
|
0x92, 0x4f, 0x79, 0x6c, 0xdd, 0x7b, 0x31, 0x92, 0x66, 0xb1, 0xae, 0xbc,
|
||||||
0x4f, 0xdb, 0x9b, 0xa6, 0xa8, 0xce, 0x93, 0xf3, 0x97, 0x61, 0xbf, 0xbc, 0x8d, 0x3b, 0xa0, 0x75,
|
0x1d, 0xe5, 0x9e, 0x29, 0xd6, 0x27, 0x21, 0xd9, 0xb1, 0x7d, 0x77, 0x6b,
|
||||||
0x04, 0x44, 0x5c, 0xe5, 0x78, 0x8b, 0xff, 0x19, 0x4b, 0xc0, 0xeb, 0x0a, 0x70, 0xb3, 0x00, 0xdc,
|
0x65, 0x3d, 0x99, 0xb6, 0x2d, 0x4f, 0x5f, 0xba, 0xe5, 0xae, 0x93, 0x81,
|
||||||
0x5e, 0x7e, 0x7b, 0x83, 0x36, 0x70, 0x51, 0x02, 0x1e, 0x17, 0x81, 0x8f, 0xfd, 0x69, 0xee, 0x17,
|
0x9e, 0x9f, 0xc9, 0x09, 0x59, 0x53, 0x6f, 0x35, 0x43, 0xf3, 0x3a, 0x39,
|
||||||
0xbf, 0xe1, 0x18, 0x97, 0x7e, 0x04, 0x00, 0x00
|
0x75, 0x75, 0x1f, 0x2c, 0xd7, 0xf9, 0x7a, 0xfa, 0xae, 0x64, 0x7d, 0x0e,
|
||||||
};
|
0xb4, 0x6f, 0xa9, 0xe6, 0xd9, 0x7b, 0x8d, 0xe5, 0xad, 0x15, 0x9c, 0xc1,
|
||||||
|
0x15, 0x19, 0x3a, 0x7f, 0x56, 0x6f, 0xa8, 0xd8, 0x8f, 0xbd, 0x2f, 0x38,
|
||||||
|
0x4f, 0xdb, 0x9b, 0xa6, 0xa8, 0xce, 0x93, 0xf3, 0x97, 0x61, 0xbf, 0xbc,
|
||||||
|
0x8d, 0x3b, 0xa0, 0x75, 0x04, 0x44, 0x5c, 0xe5, 0x78, 0x8b, 0xff, 0x19,
|
||||||
|
0x4b, 0xc0, 0xeb, 0x0a, 0x70, 0xb3, 0x00, 0xdc, 0x5e, 0x7e, 0x7b, 0x83,
|
||||||
|
0x36, 0x70, 0x51, 0x02, 0x1e, 0x17, 0x81, 0x8f, 0xfd, 0x69, 0xee, 0x17,
|
||||||
|
0xbf, 0xe1, 0x18, 0x97, 0x7e, 0x04, 0x00, 0x00};
|
||||||
#endif //__favicon_h
|
#endif //__favicon_h
|
@ -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,8 +239,8 @@ 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());
|
||||||
|
@ -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
|
||||||
|
@ -20,21 +20,19 @@
|
|||||||
#ifndef _INPUT_H
|
#ifndef _INPUT_H
|
||||||
#define _INPUT_H
|
#define _INPUT_H
|
||||||
|
|
||||||
|
class Input {
|
||||||
class Input
|
public:
|
||||||
{
|
|
||||||
public:
|
|
||||||
Input();
|
Input();
|
||||||
~Input();
|
~Input();
|
||||||
bool begin();
|
bool begin();
|
||||||
void end();
|
void end();
|
||||||
void handle();
|
void handle();
|
||||||
bool started();
|
bool started();
|
||||||
private:
|
|
||||||
|
private:
|
||||||
bool _started;
|
bool _started;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern Input esp3d_input;
|
extern Input esp3d_input;
|
||||||
|
|
||||||
#endif //_INPUT_H
|
#endif //_INPUT_H
|
||||||
|
|
||||||
|
@ -20,20 +20,16 @@
|
|||||||
#ifndef _LUA_INTERPRETER_H
|
#ifndef _LUA_INTERPRETER_H
|
||||||
#define _LUA_INTERPRETER_H
|
#define _LUA_INTERPRETER_H
|
||||||
|
|
||||||
|
class LuaInterpreter {
|
||||||
class LuaInterpreter
|
public:
|
||||||
{
|
|
||||||
public:
|
|
||||||
LuaInterpreter();
|
LuaInterpreter();
|
||||||
~LuaInterpreter();
|
~LuaInterpreter();
|
||||||
bool started()
|
bool started() { return _started; }
|
||||||
{
|
|
||||||
return _started;
|
|
||||||
}
|
|
||||||
bool begin();
|
bool begin();
|
||||||
void end();
|
void end();
|
||||||
void handle();
|
void handle();
|
||||||
private:
|
|
||||||
|
private:
|
||||||
bool _started;
|
bool _started;
|
||||||
};
|
};
|
||||||
extern LuaInterpreter esp3d_lua_interpreter;
|
extern LuaInterpreter esp3d_lua_interpreter;
|
||||||
|
@ -20,16 +20,12 @@
|
|||||||
#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()
|
bool started() { return _started; }
|
||||||
{
|
bool begin(const char* hostname);
|
||||||
return _started;
|
|
||||||
}
|
|
||||||
bool begin(const char * hostname);
|
|
||||||
void end();
|
void end();
|
||||||
void handle();
|
void handle();
|
||||||
void addESP3DServices(uint16_t port);
|
void addESP3DServices(uint16_t port);
|
||||||
@ -40,7 +36,8 @@ public:
|
|||||||
uint16_t answerTxtCount(uint16_t index);
|
uint16_t answerTxtCount(uint16_t index);
|
||||||
const char* answerTxtKey(uint16_t index, uint16_t txtIndex);
|
const char* answerTxtKey(uint16_t index, uint16_t txtIndex);
|
||||||
const char* answerTxt(uint16_t index, uint16_t txtIndex);
|
const char* answerTxt(uint16_t index, uint16_t txtIndex);
|
||||||
private:
|
|
||||||
|
private:
|
||||||
bool _started;
|
bool _started;
|
||||||
uint16_t _port;
|
uint16_t _port;
|
||||||
uint16_t _currentQueryCount;
|
uint16_t _currentQueryCount;
|
||||||
@ -48,7 +45,7 @@ private:
|
|||||||
String _hostname;
|
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
|
||||||
|
@ -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;
|
||||||
|
@ -488,7 +488,8 @@ 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) && \
|
||||||
|
(defined(ESP_GOT_IP_HOOK) || defined(ESP_GOT_DATE_TIME_HOOK))
|
||||||
timeService.handle();
|
timeService.handle();
|
||||||
#endif // TIMESTAMP_FEATURE
|
#endif // TIMESTAMP_FEATURE
|
||||||
}
|
}
|
||||||
|
@ -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 {
|
||||||
class NetServices
|
public:
|
||||||
{
|
|
||||||
public:
|
|
||||||
static bool begin();
|
static bool begin();
|
||||||
static void end();
|
static void end();
|
||||||
static void handle();
|
static void handle();
|
||||||
static bool started()
|
static bool started() { return _started; }
|
||||||
{
|
|
||||||
return _started;
|
private:
|
||||||
}
|
|
||||||
private:
|
|
||||||
static bool _started;
|
static bool _started;
|
||||||
static bool _restart;
|
static bool _restart;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //_NET_SERVICES_H
|
#endif //_NET_SERVICES_H
|
||||||
|
|
||||||
|
@ -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:
|
||||||
@ -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 +
|
||||||
|
" HTTP/1.1\r\n"
|
||||||
|
"Host: " +
|
||||||
|
_serveraddress.c_str() +
|
||||||
|
"\r\n"
|
||||||
"Connection: close\r\n"
|
"Connection: close\r\n"
|
||||||
"Cache-Control: no-cache\r\n"
|
"Cache-Control: no-cache\r\n"
|
||||||
"User-Agent: ESP3D\r\n"
|
"User-Agent: ESP3D\r\n"
|
||||||
"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n"
|
"Accept: "
|
||||||
"Authorization: Bearer " + _token1 + "\r\n"
|
"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-Type: application/json\r\n"
|
||||||
"Content-Length: " + json.length() + "\r\n"
|
"Content-Length: " +
|
||||||
"\r\n" + json;
|
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;
|
||||||
}
|
}
|
||||||
|
@ -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);
|
||||||
};
|
};
|
||||||
|
@ -18,21 +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 _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;
|
||||||
};
|
};
|
||||||
@ -40,4 +38,3 @@ private:
|
|||||||
extern RecoveryService recovery_service;
|
extern RecoveryService recovery_service;
|
||||||
|
|
||||||
#endif //_RECOVERY_SERVICE_H
|
#endif //_RECOVERY_SERVICE_H
|
||||||
|
|
||||||
|
@ -18,16 +18,13 @@
|
|||||||
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();
|
||||||
@ -35,11 +32,10 @@ public:
|
|||||||
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
|
||||||
|
|
||||||
|
@ -18,15 +18,12 @@
|
|||||||
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();
|
||||||
@ -34,11 +31,10 @@ public:
|
|||||||
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
|
||||||
|
|
||||||
|
@ -18,16 +18,13 @@
|
|||||||
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();
|
||||||
@ -35,11 +32,10 @@ public:
|
|||||||
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
|
||||||
|
|
||||||
|
@ -18,54 +18,26 @@
|
|||||||
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()
|
virtual bool begin() { return false; }
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
virtual void end() {}
|
virtual void end() {}
|
||||||
virtual bool isModelValid(uint8_t model)
|
virtual bool isModelValid(uint8_t model) { return false; }
|
||||||
{
|
virtual uint8_t getIDFromString(const char *) { return 0; }
|
||||||
return false;
|
virtual uint8_t nbType() { return 0; }
|
||||||
}
|
virtual uint8_t GetModel(uint8_t i = 0) { return 0; }
|
||||||
virtual uint8_t getIDFromString(const char *)
|
virtual const char *GetCurrentModelString() { return "None"; }
|
||||||
{
|
virtual const char *GetModelString(uint8_t i = 0) { return "None"; }
|
||||||
return 0;
|
virtual const char *GetData() { return ""; }
|
||||||
}
|
|
||||||
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();
|
||||||
@ -73,29 +45,22 @@ public:
|
|||||||
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()
|
uint interval() { return _interval; }
|
||||||
{
|
uint8_t GetModel(uint8_t i = 0);
|
||||||
return _interval;
|
const char *GetModelString(uint8_t i = 0);
|
||||||
}
|
const char *GetData();
|
||||||
uint8_t GetModel(uint8_t i=0);
|
bool started() { return _started; }
|
||||||
const char *GetModelString(uint8_t i=0);
|
|
||||||
const char * GetData();
|
protected:
|
||||||
bool started()
|
|
||||||
{
|
|
||||||
return _started;
|
|
||||||
}
|
|
||||||
protected:
|
|
||||||
bool _started;
|
bool _started;
|
||||||
uint32_t _interval;
|
uint32_t _interval;
|
||||||
uint32_t _lastReadTime;
|
uint32_t _lastReadTime;
|
||||||
ESP3DSensorDevice * _device;
|
ESP3DSensorDevice *_device;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
extern ESP3DSensor esp3d_sensor;
|
extern ESP3DSensor esp3d_sensor;
|
||||||
|
|
||||||
#endif //_ESP3D_SENSOR_H
|
#endif //_ESP3D_SENSOR_H
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
@ -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
|
||||||
|
@ -22,15 +22,14 @@
|
|||||||
#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:
|
||||||
Serial_2_Socket();
|
Serial_2_Socket();
|
||||||
|
@ -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
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
|
||||||
class TimeService {
|
class TimeService {
|
||||||
public:
|
public:
|
||||||
TimeService();
|
TimeService();
|
||||||
|
@ -21,25 +21,26 @@
|
|||||||
#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:
|
|
||||||
bool isScrambleKey(const char *key, const char * str);
|
private:
|
||||||
char * _filename;
|
bool isScrambleKey(const char *key, const char *str);
|
||||||
|
char *_filename;
|
||||||
TProcessingFunction _pfunction;
|
TProcessingFunction _pfunction;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -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';
|
||||||
|
@ -21,21 +21,18 @@
|
|||||||
#ifndef _UPDATE_SERVICES_H
|
#ifndef _UPDATE_SERVICES_H
|
||||||
#define _UPDATE_SERVICES_H
|
#define _UPDATE_SERVICES_H
|
||||||
|
|
||||||
|
class UpdateService {
|
||||||
class UpdateService
|
public:
|
||||||
{
|
|
||||||
public:
|
|
||||||
UpdateService();
|
UpdateService();
|
||||||
~UpdateService();
|
~UpdateService();
|
||||||
void handle();
|
void handle();
|
||||||
bool begin();
|
bool begin();
|
||||||
void end();
|
void end();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool flash(const char * filename, int type);
|
bool flash(const char* filename, int type);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern UpdateService update_service;
|
extern UpdateService update_service;
|
||||||
|
|
||||||
#endif //_UPDATE_SERVICES_H
|
#endif //_UPDATE_SERVICES_H
|
||||||
|
|
||||||
|
@ -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();
|
||||||
}
|
}
|
||||||
|
@ -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
32
tools/format_sources.py
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
# Base directory of the script
|
||||||
|
script_path = os.path.abspath(__file__)
|
||||||
|
|
||||||
|
# Extract dir path
|
||||||
|
script_dir = os.path.dirname(script_path)
|
||||||
|
|
||||||
|
# Build path of sources dir : ../esp3d
|
||||||
|
base_dir = os.path.abspath(os.path.normpath(os.path.join(script_dir, '..', 'esp3d')))
|
||||||
|
|
||||||
|
# Parse all c, h , cpp files in all directories and sub directories
|
||||||
|
file_paths = []
|
||||||
|
for root, dirs, files in os.walk(base_dir):
|
||||||
|
for file in files:
|
||||||
|
if file.endswith(('.c', '.cpp', '.h', '.ino')):
|
||||||
|
file_path = os.path.join(root, file)
|
||||||
|
file_paths.append(os.path.abspath(os.path.normpath(file_path)))
|
||||||
|
|
||||||
|
# Now format all files one by one with clang-format
|
||||||
|
for file_path in file_paths:
|
||||||
|
tmpPath = '"' + file_path + '"'
|
||||||
|
print("Formating " + tmpPath, end="")
|
||||||
|
try:
|
||||||
|
command = ['clang-format', '-i', '--style=Google', file_path]
|
||||||
|
subprocess.run(command, check=False)
|
||||||
|
print("=> Ok")
|
||||||
|
except subprocess.CalledProcessError as e:
|
||||||
|
print(f'=>Error : {e}')
|
Loading…
x
Reference in New Issue
Block a user