update code base to Marlin 2.0.9.2

This commit is contained in:
Stefan Kalscheuer
2021-10-03 18:57:12 +02:00
parent b9d7ba838e
commit 7077da3591
2617 changed files with 332093 additions and 103438 deletions

74
Marlin/src/HAL/ESP32/HAL.cpp Executable file → Normal file
View File

@@ -16,21 +16,18 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#ifdef ARDUINO_ARCH_ESP32
#include "HAL.h"
#include "timers.h"
#include "../../inc/MarlinConfig.h"
#include <rom/rtc.h>
#include <driver/adc.h>
#include <esp_adc_cal.h>
#include <HardwareSerial.h>
#include "../../inc/MarlinConfigPre.h"
#if ENABLED(WIFISUPPORT)
#include <ESPAsyncWebServer.h>
#include "wifi.h"
@@ -43,6 +40,10 @@
#endif
#endif
#if ENABLED(ESP3D_WIFISUPPORT)
DefaultSerial1 MSerial0(false, Serial2Socket);
#endif
// ------------------------
// Externs
// ------------------------
@@ -89,17 +90,13 @@ volatile int numPWMUsed = 0,
#endif
void HAL_init() { i2s_init(); }
void HAL_init_board() {
#if ENABLED(ESP3D_WIFISUPPORT)
esp3dlib.init();
#elif ENABLED(WIFISUPPORT)
wifi_init();
#if ENABLED(OTASUPPORT)
OTA_init();
#endif
TERN_(OTASUPPORT, OTA_init());
#if ENABLED(WEBSUPPORT)
spiffs_init();
web_init();
@@ -127,21 +124,25 @@ void HAL_init_board() {
#endif
#endif
// Initialize the i2s peripheral only if the I2S stepper stream is enabled.
// The following initialization is performed after Serial1 and Serial2 are defined as
// their native pins might conflict with the i2s stream even when they are remapped.
TERN_(I2S_STEPPER_STREAM, i2s_init());
}
void HAL_idletask() {
#if BOTH(WIFISUPPORT, OTASUPPORT)
OTA_handle();
#endif
#if ENABLED(ESP3D_WIFISUPPORT)
esp3dlib.idletask();
#endif
TERN_(ESP3D_WIFISUPPORT, esp3dlib.idletask());
}
void HAL_clear_reset_source() { }
uint8_t HAL_get_reset_source() { return rtc_get_reset_reason(1); }
void HAL_reboot() { ESP.restart(); }
void _delay_ms(int delay_ms) { delay(delay_ms); }
// return free memory between end of heap (or end bss) and whatever is current
@@ -176,39 +177,18 @@ void HAL_adc_init() {
adc1_config_width(ADC_WIDTH_12Bit);
// Configure channels only if used as (re-)configuring a pin for ADC that is used elsewhere might have adverse effects
#if HAS_TEMP_ADC_0
adc1_set_attenuation(get_channel(TEMP_0_PIN), ADC_ATTEN_11db);
#endif
#if HAS_TEMP_ADC_1
adc1_set_attenuation(get_channel(TEMP_1_PIN), ADC_ATTEN_11db);
#endif
#if HAS_TEMP_ADC_2
adc1_set_attenuation(get_channel(TEMP_2_PIN), ADC_ATTEN_11db);
#endif
#if HAS_TEMP_ADC_3
adc1_set_attenuation(get_channel(TEMP_3_PIN), ADC_ATTEN_11db);
#endif
#if HAS_TEMP_ADC_4
adc1_set_attenuation(get_channel(TEMP_4_PIN), ADC_ATTEN_11db);
#endif
#if HAS_TEMP_ADC_5
adc1_set_attenuation(get_channel(TEMP_5_PIN), ADC_ATTEN_11db);
#endif
#if HAS_TEMP_ADC_6
adc2_set_attenuation(get_channel(TEMP_6_PIN), ADC_ATTEN_11db);
#endif
#if HAS_TEMP_ADC_7
adc3_set_attenuation(get_channel(TEMP_7_PIN), ADC_ATTEN_11db);
#endif
#if HAS_HEATED_BED
adc1_set_attenuation(get_channel(TEMP_BED_PIN), ADC_ATTEN_11db);
#endif
#if HAS_TEMP_CHAMBER
adc1_set_attenuation(get_channel(TEMP_CHAMBER_PIN), ADC_ATTEN_11db);
#endif
#if ENABLED(FILAMENT_WIDTH_SENSOR)
adc1_set_attenuation(get_channel(FILWIDTH_PIN), ADC_ATTEN_11db);
#endif
TERN_(HAS_TEMP_ADC_0, adc1_set_attenuation(get_channel(TEMP_0_PIN), ADC_ATTEN_11db));
TERN_(HAS_TEMP_ADC_1, adc1_set_attenuation(get_channel(TEMP_1_PIN), ADC_ATTEN_11db));
TERN_(HAS_TEMP_ADC_2, adc1_set_attenuation(get_channel(TEMP_2_PIN), ADC_ATTEN_11db));
TERN_(HAS_TEMP_ADC_3, adc1_set_attenuation(get_channel(TEMP_3_PIN), ADC_ATTEN_11db));
TERN_(HAS_TEMP_ADC_4, adc1_set_attenuation(get_channel(TEMP_4_PIN), ADC_ATTEN_11db));
TERN_(HAS_TEMP_ADC_5, adc1_set_attenuation(get_channel(TEMP_5_PIN), ADC_ATTEN_11db));
TERN_(HAS_TEMP_ADC_6, adc2_set_attenuation(get_channel(TEMP_6_PIN), ADC_ATTEN_11db));
TERN_(HAS_TEMP_ADC_7, adc3_set_attenuation(get_channel(TEMP_7_PIN), ADC_ATTEN_11db));
TERN_(HAS_HEATED_BED, adc1_set_attenuation(get_channel(TEMP_BED_PIN), ADC_ATTEN_11db));
TERN_(HAS_TEMP_CHAMBER, adc1_set_attenuation(get_channel(TEMP_CHAMBER_PIN), ADC_ATTEN_11db));
TERN_(HAS_TEMP_COOLER, adc1_set_attenuation(get_channel(TEMP_COOLER_PIN), ADC_ATTEN_11db));
TERN_(FILAMENT_WIDTH_SENSOR, adc1_set_attenuation(get_channel(FILWIDTH_PIN), ADC_ATTEN_11db));
// Note that adc2 is shared with the WiFi module, which has higher priority, so the conversion may fail.
// That's why we're not setting it up here.