mirror of
https://git.mirrors.martin98.com/https://github.com/luc-github/ESP3D.git
synced 2025-08-13 03:09:10 +08:00
Add pin setup for sharing
Add [ESP202] command to set SPI Speed factor
This commit is contained in:
parent
f87cbee4d2
commit
223d7ece34
@ -83,6 +83,9 @@ if PULLUP=YES set input pull up (for GPIO16(ESP8266) INPUT_PULLDOWN_16), if not
|
||||
if RAW=YES do not set pinmode just read value
|
||||
Flash pins (6~11) cannot be used
|
||||
|
||||
*Get/Set SD card Speed factor 1 2 4 6 8 16 32
|
||||
[ESP202]SPEED=<value>pwd=<user/admin password>
|
||||
|
||||
* Output to esp screen status
|
||||
[ESP214]<Text>pwd=<user password>
|
||||
|
||||
@ -225,4 +228,4 @@ rmdir / remove / mkdir / exists / create
|
||||
[ESP910]<ENABLE/DISABLE>[pwd=<admin/user password>]
|
||||
|
||||
*Get state / Set state of output message clients
|
||||
[ESP910]<SERIAL / LCD / PRINTER_LCD/ WEBSOCKET / TELNET /BT / ALL>=<ON/OFF>[pwd=<admin/user password>]
|
||||
[ESP920]<SERIAL / LCD / PRINTER_LCD/ WEBSOCKET / TELNET /BT / ALL>=<ON/OFF>[pwd=<admin/user password>]
|
||||
|
@ -414,6 +414,11 @@ bool Commands::execute_internal_command (int cmd, const char* cmd_params, level_
|
||||
case 200:
|
||||
response = ESP200(cmd_params, auth_type, output);
|
||||
break;
|
||||
//Get/Set SD card Speed factor 1 2 4 6 8 16 32
|
||||
//[ESP202]SPEED=<value>pwd=<user/admin password>
|
||||
case 202:
|
||||
response = ESP202(cmd_params, auth_type, output);
|
||||
break;
|
||||
#ifdef SD_UPDATE_FEATURE
|
||||
//Get/Set SD Check at boot state which can be ON, OFF
|
||||
//[ESP402]<state>pwd=<admin password>
|
||||
|
@ -86,6 +86,7 @@ public:
|
||||
#endif //FTP_FEATURE
|
||||
#if defined (SD_DEVICE)
|
||||
bool ESP200(const char* cmd_params, level_authenticate_type auth_level, ESP3DOutput * output);
|
||||
bool ESP202(const char* cmd_params, level_authenticate_type auth_level, ESP3DOutput * output);
|
||||
#ifdef SD_UPDATE_FEATURE
|
||||
bool ESP402(const char* cmd_params, level_authenticate_type auth_level, ESP3DOutput * output);
|
||||
#endif //SD_UPDATE_FEATURE
|
||||
|
@ -76,6 +76,9 @@ const char * help[]= {"[ESP] - display this help",
|
||||
#ifdef DIRECT_PIN_FEATURE
|
||||
"[ESP201](Pxxx) (Vxxx) (PULLUP=YES RAW=YES ANALOG=NO ANALOG_RANGE=255 CLEARCHANNELS=NO) - read / set pin value",
|
||||
#endif //DIRECT_PIN_FEATURE
|
||||
#if defined (SD_DEVICE)
|
||||
"[ESP202] - display / set SD Card SD card Speed factor (1 2 4 6 8 16 32)",
|
||||
#endif //SD_DEVICE
|
||||
#ifdef SENSOR_DEVICE
|
||||
"[ESP210](type=NONE/xxx) (interval=xxxx) - display and read/set SENSOR info",
|
||||
#endif //SENSOR_DEVICE
|
||||
|
65
esp3d/src/core/espcmd/ESP202.cpp
Normal file
65
esp3d/src/core/espcmd/ESP202.cpp
Normal file
@ -0,0 +1,65 @@
|
||||
/*
|
||||
ESP202.cpp - ESP3D command class
|
||||
|
||||
Copyright (c) 2014 Luc Lebosse. All rights reserved.
|
||||
|
||||
This code is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This code is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with This code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
#include "../../include/esp3d_config.h"
|
||||
#if defined (SD_DEVICE)
|
||||
#include "../commands.h"
|
||||
#include "../esp3doutput.h"
|
||||
#include "../settings_esp3d.h"
|
||||
#include "../../modules/filesystem/esp_sd.h"
|
||||
#include "../../modules/authentication/authentication_service.h"
|
||||
//Get/Set SD card Speed factor 1 2 4 6 8 16 32
|
||||
//[ESP202]SPEED=<value>pwd=<user/admin password>
|
||||
bool Commands::ESP202(const char* cmd_params, level_authenticate_type auth_type, ESP3DOutput * output)
|
||||
{
|
||||
(void)cmd_params;
|
||||
#ifdef AUTHENTICATION_FEATURE
|
||||
if (auth_type == LEVEL_GUEST) {
|
||||
output->printERROR("Wrong authentication!", 401);
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
(void)auth_type;
|
||||
#endif //AUTHENTICATION_FEATURE
|
||||
bool response = true;
|
||||
String parameter;
|
||||
parameter = get_param (cmd_params, "");
|
||||
//get
|
||||
if (parameter.length() == 0) {
|
||||
String r = "SPEED=" + String(Settings_ESP3D::read_byte (ESP_SD_SPEED_DIV));
|
||||
output->printMSG (r.c_str());
|
||||
} else { //set
|
||||
parameter = get_param (cmd_params, "SPEED=");
|
||||
if ((parameter == "1") || (parameter == "2") || (parameter == "4")|| (parameter == "6")|| (parameter == "8")|| (parameter == "16")|| (parameter == "32")) {
|
||||
if (!Settings_ESP3D::write_byte (ESP_SD_SPEED_DIV, parameter.toInt())) {
|
||||
response = false;
|
||||
output->printERROR ("Set failed!");
|
||||
} else {
|
||||
ESP_SD::setSPISpeedDivider(parameter.toInt());
|
||||
output->printMSG ("ok");
|
||||
}
|
||||
} else {
|
||||
output->printERROR ("Invalid parameter!");
|
||||
response = false;
|
||||
}
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
#endif //SD_DEVICE
|
@ -195,6 +195,13 @@ bool Hal::begin()
|
||||
WiFi.enableSTA (false);
|
||||
WiFi.enableAP (false);
|
||||
WiFi.mode (WIFI_OFF);
|
||||
#if SD_DEVICE_CONNECTION == ESP_SHARED_SD
|
||||
#if defined(ESP_SD_DETECT_PIN) && ESP_SD_DETECT_PIN != -1
|
||||
pinMode (ESP_SD_DETECT_PIN, INPUT);
|
||||
#endif
|
||||
pinMode (ESP_FLAG_SHARED_SD_PIN, OUTPUT);
|
||||
digitalWrite(ESP_FLAG_SHARED_SD_PIN, !ESP_FLAG_SHARED_SD_VALUE);
|
||||
#endif //SD_DEVICE_CONNECTION == ESP_SHARED_SD
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
#define _VERSION_ESP3D_H
|
||||
|
||||
//version and sources location
|
||||
#define FW_VERSION "3.0.0.a72"
|
||||
#define FW_VERSION "3.0.0.a73"
|
||||
#define REPOSITORY "https://github.com/luc-github/ESP3D/tree/3.0"
|
||||
|
||||
#endif //_VERSION_ESP3D_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user