Merge remote-tracking branch 'upstream/bugfix-2.0.x' into 2.0.x
commit
0673f335e1
@ -0,0 +1,25 @@
|
|||||||
|
#
|
||||||
|
# bump-date.yml
|
||||||
|
# Bump the distribution date once per day
|
||||||
|
#
|
||||||
|
|
||||||
|
name: Bump Distribution Date
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 0 * * *'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
bump_date:
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
|
||||||
|
- name: Check out bugfix-2.0.x
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
ref: bugfix-2.0.x
|
||||||
|
|
||||||
|
- name: Bump Distribution Date
|
||||||
|
run: source ./buildroot/bin/bump_date
|
@ -0,0 +1,100 @@
|
|||||||
|
#
|
||||||
|
# test-builds.yml
|
||||||
|
# Do test builds to catch compile errors
|
||||||
|
#
|
||||||
|
|
||||||
|
name: CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- bugfix-2.0.x
|
||||||
|
- dev-2.1.x
|
||||||
|
paths-ignore:
|
||||||
|
- config/**
|
||||||
|
- data/**
|
||||||
|
- docs/**
|
||||||
|
- '**/*.md'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test_builds:
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
test-platform:
|
||||||
|
# Base Environments
|
||||||
|
|
||||||
|
- DUE
|
||||||
|
- esp32
|
||||||
|
- linux_native
|
||||||
|
- megaatmega2560
|
||||||
|
- teensy31
|
||||||
|
- teensy35
|
||||||
|
|
||||||
|
# Extended AVR Environments
|
||||||
|
|
||||||
|
- FYSETC_F6_13
|
||||||
|
- megaatmega1280
|
||||||
|
- rambo
|
||||||
|
- sanguino_atmega1284p
|
||||||
|
- sanguino_atmega644p
|
||||||
|
|
||||||
|
# Extended STM32 Environments
|
||||||
|
|
||||||
|
- STM32F103RC_bigtree
|
||||||
|
- STM32F103RC_bigtree_USB
|
||||||
|
- STM32F103RE_bigtree
|
||||||
|
- STM32F103RE_bigtree_USB
|
||||||
|
- STM32F103RC_fysetc
|
||||||
|
- jgaurora_a5s_a1
|
||||||
|
- STM32F103VE_longer
|
||||||
|
- STM32F407VE_black
|
||||||
|
- BIGTREE_SKR_PRO
|
||||||
|
- mks_robin
|
||||||
|
- ARMED
|
||||||
|
|
||||||
|
# Put lengthy tests last
|
||||||
|
|
||||||
|
- LPC1768
|
||||||
|
- LPC1769
|
||||||
|
|
||||||
|
# STM32 with non-STM framework. both broken for now. they should use HAL_STM32 which is working.
|
||||||
|
|
||||||
|
#- STM32F4
|
||||||
|
#- STM32F7
|
||||||
|
|
||||||
|
# Non-working environment tests
|
||||||
|
|
||||||
|
#- BIGTREE_BTT002
|
||||||
|
#- at90usb1286_cdc
|
||||||
|
#- at90usb1286_dfu
|
||||||
|
#- STM32F103CB_malyan
|
||||||
|
#- mks_robin_lite
|
||||||
|
#- mks_robin_mini
|
||||||
|
#- mks_robin_nano
|
||||||
|
#- SAMD51_grandcentral_m4
|
||||||
|
|
||||||
|
steps:
|
||||||
|
|
||||||
|
- name: Select Python 3.7
|
||||||
|
uses: actions/setup-python@v1
|
||||||
|
with:
|
||||||
|
python-version: '3.7' # Version range or exact version of a Python version to use, using semvers version range syntax.
|
||||||
|
architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified
|
||||||
|
|
||||||
|
- name: Install PlatformIO
|
||||||
|
run: |
|
||||||
|
pip install -U https://github.com/platformio/platformio-core/archive/master.zip
|
||||||
|
platformio update
|
||||||
|
|
||||||
|
- name: Check out the PR
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Run ${{ matrix.test-platform }} Tests
|
||||||
|
run: |
|
||||||
|
chmod +x buildroot/bin/*
|
||||||
|
chmod +x buildroot/share/tests/*
|
||||||
|
export PATH=./buildroot/bin/:./buildroot/share/tests/:${PATH}
|
||||||
|
run_tests . ${{ matrix.test-platform }}
|
@ -1,84 +0,0 @@
|
|||||||
dist: bionic
|
|
||||||
sudo: false
|
|
||||||
|
|
||||||
language: python
|
|
||||||
python:
|
|
||||||
- "3.7"
|
|
||||||
|
|
||||||
notifications:
|
|
||||||
email: false
|
|
||||||
|
|
||||||
env:
|
|
||||||
# Base Environments
|
|
||||||
- TEST_PLATFORM="DUE"
|
|
||||||
- TEST_PLATFORM="esp32"
|
|
||||||
- TEST_PLATFORM="linux_native"
|
|
||||||
- TEST_PLATFORM="megaatmega2560"
|
|
||||||
- TEST_PLATFORM="teensy31"
|
|
||||||
- TEST_PLATFORM="teensy35"
|
|
||||||
|
|
||||||
# Extended AVR Environments
|
|
||||||
- TEST_PLATFORM="FYSETC_F6_13"
|
|
||||||
- TEST_PLATFORM="megaatmega1280"
|
|
||||||
- TEST_PLATFORM="rambo"
|
|
||||||
- TEST_PLATFORM="sanguino_atmega1284p"
|
|
||||||
- TEST_PLATFORM="sanguino_atmega644p"
|
|
||||||
|
|
||||||
# Extended STM32 Environments
|
|
||||||
- TEST_PLATFORM="STM32F103RC_bigtree"
|
|
||||||
- TEST_PLATFORM="STM32F103RC_bigtree_USB"
|
|
||||||
- TEST_PLATFORM="STM32F103RE_bigtree"
|
|
||||||
- TEST_PLATFORM="STM32F103RE_bigtree_USB"
|
|
||||||
- TEST_PLATFORM="STM32F103RC_fysetc"
|
|
||||||
- TEST_PLATFORM="jgaurora_a5s_a1"
|
|
||||||
- TEST_PLATFORM="STM32F103VE_longer"
|
|
||||||
- TEST_PLATFORM="STM32F407VE_black"
|
|
||||||
- TEST_PLATFORM="BIGTREE_SKR_PRO"
|
|
||||||
- TEST_PLATFORM="mks_robin"
|
|
||||||
- TEST_PLATFORM="ARMED"
|
|
||||||
|
|
||||||
# STM32 with non-STM framework. both broken for now. they should use HAL_STM32 which is working.
|
|
||||||
#- TEST_PLATFORM="STM32F4"
|
|
||||||
#- TEST_PLATFORM="STM32F7"
|
|
||||||
|
|
||||||
# Put lengthy tests last
|
|
||||||
- TEST_PLATFORM="LPC1768"
|
|
||||||
- TEST_PLATFORM="LPC1769"
|
|
||||||
|
|
||||||
# Non-working environment tests
|
|
||||||
#- TEST_PLATFORM="BIGTREE_BTT002" this board isn't released yet. we need pinout to be sure about what we do
|
|
||||||
#- TEST_PLATFORM="at90usb1286_cdc"
|
|
||||||
#- TEST_PLATFORM="at90usb1286_dfu"
|
|
||||||
#- TEST_PLATFORM="STM32F103CB_malyan"
|
|
||||||
#- TEST_PLATFORM="mks_robin_lite"
|
|
||||||
#- TEST_PLATFORM="mks_robin_mini"
|
|
||||||
#- TEST_PLATFORM="mks_robin_nano"
|
|
||||||
#- TEST_PLATFORM="SAMD51_grandcentral_m4"
|
|
||||||
|
|
||||||
before_install:
|
|
||||||
#
|
|
||||||
# Fetch the tag information for the current branch
|
|
||||||
- git fetch origin --tags
|
|
||||||
#
|
|
||||||
# Publish the buildroot script folder
|
|
||||||
- chmod +x ${TRAVIS_BUILD_DIR}/buildroot/bin/*
|
|
||||||
- chmod +x ${TRAVIS_BUILD_DIR}/buildroot/share/tests/*
|
|
||||||
- export PATH=${TRAVIS_BUILD_DIR}/buildroot/bin/:${TRAVIS_BUILD_DIR}/buildroot/share/tests/:${PATH}
|
|
||||||
|
|
||||||
install:
|
|
||||||
#- pip install -U platformio
|
|
||||||
- pip install -U https://github.com/platformio/platformio-core/archive/master.zip
|
|
||||||
|
|
||||||
before_script:
|
|
||||||
# Update PlatformIO packages
|
|
||||||
- platformio update
|
|
||||||
#
|
|
||||||
# Change current working directory to the build dir
|
|
||||||
- cd ${TRAVIS_BUILD_DIR}
|
|
||||||
#
|
|
||||||
# Generate custom version include
|
|
||||||
- generate_version ${TRAVIS_BUILD_DIR}/Marlin/
|
|
||||||
- cat ${TRAVIS_BUILD_DIR}/Marlin/Version.h
|
|
||||||
#
|
|
||||||
script:
|
|
||||||
- run_tests ${TRAVIS_BUILD_DIR} ${TEST_PLATFORM}
|
|
@ -0,0 +1,63 @@
|
|||||||
|
/**
|
||||||
|
* Marlin 3D Printer Firmware
|
||||||
|
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||||
|
*
|
||||||
|
* Based on Sprinter and grbl.
|
||||||
|
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program 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 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/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef ARDUINO_ARCH_ESP32
|
||||||
|
|
||||||
|
#include "../../inc/MarlinConfig.h"
|
||||||
|
|
||||||
|
#if ENABLED(EEPROM_SETTINGS) && DISABLED(FLASH_EEPROM_EMULATION)
|
||||||
|
|
||||||
|
#include "../shared/persistent_store_api.h"
|
||||||
|
#include "EEPROM.h"
|
||||||
|
|
||||||
|
#define EEPROM_SIZE 4096
|
||||||
|
|
||||||
|
bool PersistentStore::access_start() {
|
||||||
|
return EEPROM.begin(EEPROM_SIZE);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PersistentStore::access_finish() {
|
||||||
|
EEPROM.end();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
|
||||||
|
for (size_t i = 0; i < size; i++) {
|
||||||
|
EEPROM.write(pos++, value[i]);
|
||||||
|
crc16(crc, &value[i], 1);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||||
|
for (size_t i = 0; i < size; i++) {
|
||||||
|
uint8_t c = EEPROM.read(pos++);
|
||||||
|
if (writing) value[i] = c;
|
||||||
|
crc16(crc, &c, 1);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t PersistentStore::capacity() { return EEPROM_SIZE; }
|
||||||
|
|
||||||
|
#endif // EEPROM_SETTINGS
|
||||||
|
#endif // ARDUINO_ARCH_ESP32
|
@ -1,106 +0,0 @@
|
|||||||
/**
|
|
||||||
* Marlin 3D Printer Firmware
|
|
||||||
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
||||||
*
|
|
||||||
* Based on Sprinter and grbl.
|
|
||||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program 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 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/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef ARDUINO_ARCH_ESP32
|
|
||||||
|
|
||||||
#include "../../inc/MarlinConfig.h"
|
|
||||||
|
|
||||||
#if ENABLED(EEPROM_SETTINGS) && DISABLED(FLASH_EEPROM_EMULATION)
|
|
||||||
|
|
||||||
#include "../shared/persistent_store_api.h"
|
|
||||||
|
|
||||||
#include <SPIFFS.h>
|
|
||||||
#include <FS.h>
|
|
||||||
#include "spiffs.h"
|
|
||||||
|
|
||||||
#define HAL_ESP32_EEPROM_SIZE 4096
|
|
||||||
#define HAL_ESP32_EEPROM_FILE_PATH "/eeprom.dat"
|
|
||||||
|
|
||||||
File eeprom_file;
|
|
||||||
|
|
||||||
bool PersistentStore::access_start() {
|
|
||||||
if (spiffs_initialized) {
|
|
||||||
eeprom_file = SPIFFS.open(HAL_ESP32_EEPROM_FILE_PATH, "r+");
|
|
||||||
|
|
||||||
size_t file_size = eeprom_file.size();
|
|
||||||
if (file_size < HAL_ESP32_EEPROM_SIZE) {
|
|
||||||
SERIAL_ECHO_MSG("SPIFFS EEPROM settings file " HAL_ESP32_EEPROM_FILE_PATH " is too small or did not exist, expanding.");
|
|
||||||
SERIAL_ECHO_START(); SERIAL_ECHOLNPAIR(" file size: ", file_size, ", required size: ", HAL_ESP32_EEPROM_SIZE);
|
|
||||||
|
|
||||||
// mode r+ does not allow to expand the file (at least on ESP32 SPIFFS9, so we close, reopen "a", append, close, reopen "r+"
|
|
||||||
eeprom_file.close();
|
|
||||||
|
|
||||||
eeprom_file = SPIFFS.open(HAL_ESP32_EEPROM_FILE_PATH, "a");
|
|
||||||
for (size_t i = eeprom_file.size(); i < HAL_ESP32_EEPROM_SIZE; i++)
|
|
||||||
eeprom_file.write(0xFF);
|
|
||||||
eeprom_file.close();
|
|
||||||
|
|
||||||
eeprom_file = SPIFFS.open(HAL_ESP32_EEPROM_FILE_PATH, "r+");
|
|
||||||
file_size = eeprom_file.size();
|
|
||||||
if (file_size < HAL_ESP32_EEPROM_SIZE) {
|
|
||||||
SERIAL_ERROR_MSG("Failed to expand " HAL_ESP32_EEPROM_FILE_PATH " to required size. SPIFFS partition full?");
|
|
||||||
SERIAL_ERROR_START(); SERIAL_ECHOLNPAIR(" file size: ", file_size, ", required size: ", HAL_ESP32_EEPROM_SIZE);
|
|
||||||
SERIAL_ERROR_START(); SERIAL_ECHOLNPAIR(" SPIFFS used bytes: ", SPIFFS.usedBytes(), ", total bytes: ", SPIFFS.totalBytes());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool PersistentStore::access_finish() {
|
|
||||||
eeprom_file.close();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
|
|
||||||
if (!eeprom_file.seek(pos)) return true; // return true for any error
|
|
||||||
if (eeprom_file.write(value, size) != size) return true;
|
|
||||||
|
|
||||||
crc16(crc, value, size);
|
|
||||||
pos += size;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
|
||||||
if (!eeprom_file.seek(pos)) return true; // return true for any error
|
|
||||||
|
|
||||||
if (writing) {
|
|
||||||
if (eeprom_file.read(value, size) != size) return true;
|
|
||||||
crc16(crc, value, size);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
uint8_t tmp[size];
|
|
||||||
if (eeprom_file.read(tmp, size) != size) return true;
|
|
||||||
crc16(crc, tmp, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
pos += size;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t PersistentStore::capacity() { return HAL_ESP32_EEPROM_SIZE; }
|
|
||||||
|
|
||||||
#endif // EEPROM_SETTINGS
|
|
||||||
#endif // ARDUINO_ARCH_ESP32
|
|
@ -0,0 +1,265 @@
|
|||||||
|
/**
|
||||||
|
* Marlin 3D Printer Firmware
|
||||||
|
*
|
||||||
|
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||||
|
* Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com
|
||||||
|
* Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com
|
||||||
|
* Copyright (c) 2016 Victor Perez victor_pv@hotmail.com
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program 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 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/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC)
|
||||||
|
|
||||||
|
#include "../../inc/MarlinConfig.h"
|
||||||
|
|
||||||
|
#if BOTH(EEPROM_SETTINGS, FLASH_EEPROM_EMULATION)
|
||||||
|
|
||||||
|
#include "../shared/persistent_store_api.h"
|
||||||
|
|
||||||
|
|
||||||
|
// Only STM32F4 can support wear leveling at this time
|
||||||
|
#ifndef STM32F4xx
|
||||||
|
#undef FLASH_EEPROM_LEVELING
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The STM32 HAL supports chips that deal with "pages" and some with "sectors" and some that
|
||||||
|
* even have multiple "banks" of flash.
|
||||||
|
*
|
||||||
|
* This code is a bit of a mashup of
|
||||||
|
* framework-arduinoststm32/cores/arduino/stm32/stm32_eeprom.c
|
||||||
|
* hal/hal_lpc1768/persistent_store_flash.cpp
|
||||||
|
*
|
||||||
|
* This has only be written against those that use a single "sector" design.
|
||||||
|
*
|
||||||
|
* Those that deal with "pages" could be made to work. Looking at the STM32F07 for example, there are
|
||||||
|
* 128 "pages", each 2kB in size. If we continued with our EEPROM being 4Kb, we'd always need to operate
|
||||||
|
* on 2 of these pages. Each write, we'd use 2 different pages from a pool of pages until we are done.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if ENABLED(FLASH_EEPROM_LEVELING)
|
||||||
|
|
||||||
|
#include "stm32_def.h"
|
||||||
|
|
||||||
|
#define DEBUG_OUT ENABLED(EEPROM_CHITCHAT)
|
||||||
|
#include "src/core/debug_out.h"
|
||||||
|
|
||||||
|
#ifndef EEPROM_SIZE
|
||||||
|
#define EEPROM_SIZE 0x1000 // 4kB
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef FLASH_SECTOR
|
||||||
|
#define FLASH_SECTOR (FLASH_SECTOR_TOTAL - 1)
|
||||||
|
#endif
|
||||||
|
#ifndef FLASH_UNIT_SIZE
|
||||||
|
#define FLASH_UNIT_SIZE 0x20000 // 128kB
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define FLASH_ADDRESS_START (FLASH_END - ((FLASH_SECTOR_TOTAL - FLASH_SECTOR) * FLASH_UNIT_SIZE) + 1)
|
||||||
|
#define FLASH_ADDRESS_END (FLASH_ADDRESS_START + FLASH_UNIT_SIZE - 1)
|
||||||
|
|
||||||
|
#define EEPROM_SLOTS (FLASH_UNIT_SIZE/EEPROM_SIZE)
|
||||||
|
#define SLOT_ADDRESS(slot) (FLASH_ADDRESS_START + (slot * EEPROM_SIZE))
|
||||||
|
|
||||||
|
#define UNLOCK_FLASH() if (!flash_unlocked) { \
|
||||||
|
HAL_FLASH_Unlock(); \
|
||||||
|
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP | FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR | \
|
||||||
|
FLASH_FLAG_PGAERR | FLASH_FLAG_PGPERR | FLASH_FLAG_PGSERR); \
|
||||||
|
flash_unlocked = true; \
|
||||||
|
}
|
||||||
|
#define LOCK_FLASH() if (flash_unlocked) { HAL_FLASH_Lock(); flash_unlocked = false; }
|
||||||
|
|
||||||
|
#define EMPTY_UINT32 ((uint32_t)-1)
|
||||||
|
#define EMPTY_UINT8 ((uint8_t)-1)
|
||||||
|
|
||||||
|
static uint8_t ram_eeprom[EEPROM_SIZE] __attribute__((aligned(4))) = {0};
|
||||||
|
static int current_slot = -1;
|
||||||
|
|
||||||
|
static_assert(0 == EEPROM_SIZE % 4, "EEPROM_SIZE must be a multiple of 4"); // Ensure copying as uint32_t is safe
|
||||||
|
static_assert(0 == FLASH_UNIT_SIZE % EEPROM_SIZE, "EEPROM_SIZE must divide evenly into your FLASH_UNIT_SIZE");
|
||||||
|
static_assert(FLASH_UNIT_SIZE >= EEPROM_SIZE, "FLASH_UNIT_SIZE must be greater than or equal to your EEPROM_SIZE");
|
||||||
|
static_assert(IS_FLASH_SECTOR(FLASH_SECTOR), "FLASH_SECTOR is invalid");
|
||||||
|
static_assert(IS_POWER_OF_2(FLASH_UNIT_SIZE), "FLASH_UNIT_SIZE should be a power of 2, please check your chip's spec sheet");
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static bool eeprom_data_written = false;
|
||||||
|
|
||||||
|
bool PersistentStore::access_start() {
|
||||||
|
|
||||||
|
#if ENABLED(FLASH_EEPROM_LEVELING)
|
||||||
|
|
||||||
|
if (current_slot == -1 || eeprom_data_written) {
|
||||||
|
// This must be the first time since power on that we have accessed the storage, or someone
|
||||||
|
// loaded and called write_data and never called access_finish.
|
||||||
|
// Lets go looking for the slot that holds our configuration.
|
||||||
|
if (eeprom_data_written) DEBUG_ECHOLN("Dangling EEPROM write_data");
|
||||||
|
uint32_t address = FLASH_ADDRESS_START;
|
||||||
|
while (address <= FLASH_ADDRESS_END) {
|
||||||
|
uint32_t address_value = (*(__IO uint32_t*)address);
|
||||||
|
if (address_value != EMPTY_UINT32) {
|
||||||
|
current_slot = (address - FLASH_ADDRESS_START) / EEPROM_SIZE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
address += sizeof(uint32_t);
|
||||||
|
}
|
||||||
|
if (current_slot == -1) {
|
||||||
|
// We didn't find anything, so we'll just intialize to empty
|
||||||
|
for (int i = 0; i < EEPROM_SIZE; i++) ram_eeprom[i] = EMPTY_UINT8;
|
||||||
|
current_slot = EEPROM_SLOTS;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// load current settings
|
||||||
|
uint8_t *eeprom_data = (uint8_t *)SLOT_ADDRESS(current_slot);
|
||||||
|
for (int i = 0; i < EEPROM_SIZE; i++) ram_eeprom[i] = eeprom_data[i];
|
||||||
|
DEBUG_ECHOLNPAIR("EEPROM loaded from slot ", current_slot, ".");
|
||||||
|
}
|
||||||
|
eeprom_data_written = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
eeprom_buffer_fill();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PersistentStore::access_finish() {
|
||||||
|
|
||||||
|
if (eeprom_data_written) {
|
||||||
|
|
||||||
|
#if ENABLED(FLASH_EEPROM_LEVELING)
|
||||||
|
|
||||||
|
HAL_StatusTypeDef status = HAL_ERROR;
|
||||||
|
bool flash_unlocked = false;
|
||||||
|
|
||||||
|
if (--current_slot < 0) {
|
||||||
|
// all slots have been used, erase everything and start again
|
||||||
|
|
||||||
|
FLASH_EraseInitTypeDef EraseInitStruct;
|
||||||
|
uint32_t SectorError = 0;
|
||||||
|
|
||||||
|
EraseInitStruct.TypeErase = FLASH_TYPEERASE_SECTORS;
|
||||||
|
EraseInitStruct.VoltageRange = FLASH_VOLTAGE_RANGE_3;
|
||||||
|
EraseInitStruct.Sector = FLASH_SECTOR;
|
||||||
|
EraseInitStruct.NbSectors = 1;
|
||||||
|
|
||||||
|
current_slot = EEPROM_SLOTS - 1;
|
||||||
|
UNLOCK_FLASH();
|
||||||
|
|
||||||
|
status = HAL_FLASHEx_Erase(&EraseInitStruct, &SectorError);
|
||||||
|
if (status != HAL_OK) {
|
||||||
|
DEBUG_ECHOLNPAIR("HAL_FLASHEx_Erase=", status);
|
||||||
|
DEBUG_ECHOLNPAIR("GetError=", HAL_FLASH_GetError());
|
||||||
|
DEBUG_ECHOLNPAIR("SectorError=", SectorError);
|
||||||
|
LOCK_FLASH();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
UNLOCK_FLASH();
|
||||||
|
|
||||||
|
uint32_t offset = 0;
|
||||||
|
uint32_t address = SLOT_ADDRESS(current_slot);
|
||||||
|
uint32_t address_end = address + EEPROM_SIZE;
|
||||||
|
uint32_t data = 0;
|
||||||
|
|
||||||
|
bool success = true;
|
||||||
|
|
||||||
|
while (address < address_end) {
|
||||||
|
memcpy(&data, ram_eeprom + offset, sizeof(uint32_t));
|
||||||
|
status = HAL_FLASH_Program(FLASH_TYPEPROGRAM_WORD, address, data);
|
||||||
|
if (status == HAL_OK) {
|
||||||
|
address += sizeof(uint32_t);
|
||||||
|
offset += sizeof(uint32_t);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
DEBUG_ECHOLNPAIR("HAL_FLASH_Program=", status);
|
||||||
|
DEBUG_ECHOLNPAIR("GetError=", HAL_FLASH_GetError());
|
||||||
|
DEBUG_ECHOLNPAIR("address=", address);
|
||||||
|
success = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCK_FLASH();
|
||||||
|
|
||||||
|
if (success) {
|
||||||
|
eeprom_data_written = false;
|
||||||
|
DEBUG_ECHOLNPAIR("EEPROM saved to slot ", current_slot, ".");
|
||||||
|
}
|
||||||
|
|
||||||
|
return success;
|
||||||
|
|
||||||
|
#else
|
||||||
|
eeprom_buffer_flush();
|
||||||
|
eeprom_data_written = false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
|
||||||
|
while (size--) {
|
||||||
|
uint8_t v = *value;
|
||||||
|
#if ENABLED(FLASH_EEPROM_LEVELING)
|
||||||
|
if (v != ram_eeprom[pos]) {
|
||||||
|
ram_eeprom[pos] = v;
|
||||||
|
eeprom_data_written = true;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
if (v != eeprom_buffered_read_byte(pos)) {
|
||||||
|
eeprom_buffered_write_byte(pos, v);
|
||||||
|
eeprom_data_written = true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
crc16(crc, &v, 1);
|
||||||
|
pos++;
|
||||||
|
value++;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||||
|
do {
|
||||||
|
const uint8_t c = (
|
||||||
|
#if ENABLED(FLASH_EEPROM_LEVELING)
|
||||||
|
ram_eeprom[pos]
|
||||||
|
#else
|
||||||
|
eeprom_buffered_read_byte(pos)
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
if (writing) *value = c;
|
||||||
|
crc16(crc, &c, 1);
|
||||||
|
pos++;
|
||||||
|
value++;
|
||||||
|
} while (--size);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t PersistentStore::capacity() {
|
||||||
|
return (
|
||||||
|
#if ENABLED(FLASH_EEPROM_LEVELING)
|
||||||
|
EEPROM_SIZE
|
||||||
|
#else
|
||||||
|
E2END + 1
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // EEPROM_SETTINGS && FLASH_EEPROM_EMULATION
|
||||||
|
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC
|
@ -0,0 +1,101 @@
|
|||||||
|
/**
|
||||||
|
* Marlin 3D Printer Firmware
|
||||||
|
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||||
|
*
|
||||||
|
* Based on Sprinter and grbl.
|
||||||
|
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program 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 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/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MRR ESPA pin assignments
|
||||||
|
* MRR ESPA is a 3D printer control board based on the ESP32 microcontroller.
|
||||||
|
* Supports 4 stepper drivers, heated bed, single hotend.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef ARDUINO_ARCH_ESP32
|
||||||
|
#error "Oops! Select an ESP32 board in 'Tools > Board.'"
|
||||||
|
#elif EXTRUDERS > 1 || E_STEPPERS > 1
|
||||||
|
#error "MRR ESPA only supports one E Stepper. Comment out this line to continue."
|
||||||
|
#elif HOTENDS > 1
|
||||||
|
#error "MRR ESPA currently supports only one hotend. Comment out this line to continue."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define BOARD_INFO_NAME "MRR ESPA"
|
||||||
|
#define BOARD_WEBSITE_URL "github.com/maplerainresearch/MRR_ESPA"
|
||||||
|
#define DEFAULT_MACHINE_NAME BOARD_INFO_NAME
|
||||||
|
|
||||||
|
//
|
||||||
|
// Disable I2S stepper stream
|
||||||
|
//
|
||||||
|
#ifdef I2S_STEPPER_STREAM
|
||||||
|
#undef I2S_STEPPER_STREAM
|
||||||
|
#endif
|
||||||
|
#define I2S_WS -1
|
||||||
|
#define I2S_BCK -1
|
||||||
|
#define I2S_DATA -1
|
||||||
|
|
||||||
|
//
|
||||||
|
// Limit Switches
|
||||||
|
//
|
||||||
|
#define X_STOP_PIN 34
|
||||||
|
#define Y_STOP_PIN 35
|
||||||
|
#define Z_STOP_PIN 15
|
||||||
|
|
||||||
|
//
|
||||||
|
// Steppers
|
||||||
|
//
|
||||||
|
#define X_STEP_PIN 27
|
||||||
|
#define X_DIR_PIN 26
|
||||||
|
#define X_ENABLE_PIN 25
|
||||||
|
//#define X_CS_PIN 21
|
||||||
|
|
||||||
|
#define Y_STEP_PIN 33
|
||||||
|
#define Y_DIR_PIN 32
|
||||||
|
#define Y_ENABLE_PIN X_ENABLE_PIN
|
||||||
|
//#define Y_CS_PIN 22
|
||||||
|
|
||||||
|
#define Z_STEP_PIN 14
|
||||||
|
#define Z_DIR_PIN 12
|
||||||
|
#define Z_ENABLE_PIN X_ENABLE_PIN
|
||||||
|
//#define Z_CS_PIN 5 // SS_PIN
|
||||||
|
|
||||||
|
#define E0_STEP_PIN 16
|
||||||
|
#define E0_DIR_PIN 17
|
||||||
|
#define E0_ENABLE_PIN X_ENABLE_PIN
|
||||||
|
//#define E0_CS_PIN 21
|
||||||
|
|
||||||
|
//
|
||||||
|
// Temperature Sensors
|
||||||
|
//
|
||||||
|
#define TEMP_0_PIN 36 // Analog Input
|
||||||
|
#define TEMP_BED_PIN 39 // Analog Input
|
||||||
|
|
||||||
|
//
|
||||||
|
// Heaters / Fans
|
||||||
|
//
|
||||||
|
#define HEATER_0_PIN 2
|
||||||
|
#define FAN_PIN 13
|
||||||
|
#define HEATER_BED_PIN 4
|
||||||
|
|
||||||
|
//
|
||||||
|
// MicroSD card
|
||||||
|
//
|
||||||
|
#define MOSI_PIN 23
|
||||||
|
#define MISO_PIN 19
|
||||||
|
#define SCK_PIN 18
|
||||||
|
#define SDSS 5
|
@ -0,0 +1,154 @@
|
|||||||
|
/**
|
||||||
|
* Marlin 3D Printer Firmware
|
||||||
|
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||||
|
*
|
||||||
|
* Based on Sprinter and grbl.
|
||||||
|
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program 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 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/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MRR ESPE pin assignments
|
||||||
|
* MRR ESPE is a 3D printer control board based on the ESP32 microcontroller.
|
||||||
|
* Supports 5 stepper drivers (using I2S stepper stream), heated bed,
|
||||||
|
* single hotend, and LCD controller.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef ARDUINO_ARCH_ESP32
|
||||||
|
#error "Oops! Select an ESP32 board in 'Tools > Board.'"
|
||||||
|
#elif EXTRUDERS > 2 || E_STEPPERS > 2
|
||||||
|
#error "MRR ESPE only supports two E Steppers. Comment out this line to continue."
|
||||||
|
#elif HOTENDS > 1
|
||||||
|
#error "MRR ESPE currently supports only one hotend. Comment out this line to continue."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define BOARD_INFO_NAME "MRR ESPE"
|
||||||
|
#define BOARD_WEBSITE_URL "github.com/maplerainresearch/MRR_ESPE"
|
||||||
|
#define DEFAULT_MACHINE_NAME BOARD_INFO_NAME
|
||||||
|
|
||||||
|
//
|
||||||
|
// Limit Switches
|
||||||
|
//
|
||||||
|
#define X_STOP_PIN 35
|
||||||
|
#define Y_STOP_PIN 32
|
||||||
|
#define Z_STOP_PIN 33
|
||||||
|
|
||||||
|
//
|
||||||
|
// Enable I2S stepper stream
|
||||||
|
//
|
||||||
|
#undef I2S_STEPPER_STREAM
|
||||||
|
#define I2S_STEPPER_STREAM
|
||||||
|
|
||||||
|
#undef LIN_ADVANCE // Currently, I2S stream does not work with linear advance
|
||||||
|
|
||||||
|
#define I2S_WS 26
|
||||||
|
#define I2S_BCK 25
|
||||||
|
#define I2S_DATA 27
|
||||||
|
|
||||||
|
//
|
||||||
|
// Steppers
|
||||||
|
//
|
||||||
|
#define X_STEP_PIN 129
|
||||||
|
#define X_DIR_PIN 130
|
||||||
|
#define X_ENABLE_PIN 128
|
||||||
|
//#define X_CS_PIN 21
|
||||||
|
|
||||||
|
#define Y_STEP_PIN 132
|
||||||
|
#define Y_DIR_PIN 133
|
||||||
|
#define Y_ENABLE_PIN 131
|
||||||
|
//#define Y_CS_PIN 22
|
||||||
|
|
||||||
|
#define Z_STEP_PIN 135
|
||||||
|
#define Z_DIR_PIN 136
|
||||||
|
#define Z_ENABLE_PIN 134
|
||||||
|
//#define Z_CS_PIN 5 // SS_PIN
|
||||||
|
|
||||||
|
#define E0_STEP_PIN 138
|
||||||
|
#define E0_DIR_PIN 139
|
||||||
|
#define E0_ENABLE_PIN 137
|
||||||
|
//#define E0_CS_PIN 21
|
||||||
|
|
||||||
|
#define E1_STEP_PIN 141
|
||||||
|
#define E1_DIR_PIN 142
|
||||||
|
#define E1_ENABLE_PIN 140
|
||||||
|
//#define E1_CS_PIN 22
|
||||||
|
|
||||||
|
#define Z2_STEP_PIN 141
|
||||||
|
#define Z2_DIR_PIN 142
|
||||||
|
#define Z2_ENABLE_PIN 140
|
||||||
|
//#define Z2_CS_PIN 5
|
||||||
|
|
||||||
|
//
|
||||||
|
// Temperature Sensors
|
||||||
|
//
|
||||||
|
#define TEMP_0_PIN 36 // Analog Input
|
||||||
|
#define TEMP_1_PIN 34 // Analog Input
|
||||||
|
#define TEMP_BED_PIN 39 // Analog Input
|
||||||
|
|
||||||
|
//
|
||||||
|
// Heaters / Fans
|
||||||
|
//
|
||||||
|
#define HEATER_0_PIN 145 // 2
|
||||||
|
#define FAN_PIN 146 // 15
|
||||||
|
#define HEATER_BED_PIN 144 // 4
|
||||||
|
|
||||||
|
#define CONTROLLER_FAN_PIN 147
|
||||||
|
//#define E0_AUTO_FAN_PIN 148 // need to update Configuration_adv.h @section extruder
|
||||||
|
//#define E1_AUTO_FAN_PIN 149 // need to update Configuration_adv.h @section extruder
|
||||||
|
#define FAN1_PIN 149
|
||||||
|
|
||||||
|
//
|
||||||
|
// MicroSD card
|
||||||
|
//
|
||||||
|
#define MOSI_PIN 23
|
||||||
|
#define MISO_PIN 19
|
||||||
|
#define SCK_PIN 18
|
||||||
|
#define SDSS 5
|
||||||
|
|
||||||
|
//////////////////////////
|
||||||
|
// LCDs and Controllers //
|
||||||
|
//////////////////////////
|
||||||
|
|
||||||
|
#if HAS_GRAPHICAL_LCD
|
||||||
|
|
||||||
|
#define LCD_PINS_RS 13
|
||||||
|
#define LCD_PINS_ENABLE 17
|
||||||
|
#define LCD_PINS_D4 16
|
||||||
|
|
||||||
|
#if ENABLED(CR10_STOCKDISPLAY)
|
||||||
|
|
||||||
|
#define BEEPER_PIN 151
|
||||||
|
|
||||||
|
#elif ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER)
|
||||||
|
|
||||||
|
#define BEEPER_PIN 152
|
||||||
|
|
||||||
|
//#define LCD_PINS_D5 150
|
||||||
|
//#define LCD_PINS_D6 151
|
||||||
|
//#define LCD_PINS_D7 153
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#error "Only CR10_STOCKDISPLAY and REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER are currently supported. Comment out this line to continue."
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define BTN_EN1 0
|
||||||
|
#define BTN_EN2 12
|
||||||
|
#define BTN_ENC 14
|
||||||
|
|
||||||
|
#endif // HAS_GRAPHICAL_LCD
|
@ -0,0 +1,280 @@
|
|||||||
|
/**
|
||||||
|
* Marlin 3D Printer Firmware
|
||||||
|
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||||
|
*
|
||||||
|
* Based on Sprinter and grbl.
|
||||||
|
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program 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 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/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#define BOARD_INFO_NAME "BIGTREE SKR 1.4"
|
||||||
|
|
||||||
|
//
|
||||||
|
// SD Connection
|
||||||
|
//
|
||||||
|
#ifndef SDCARD_CONNECTION
|
||||||
|
#define SDCARD_CONNECTION LCD
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//
|
||||||
|
// Servos
|
||||||
|
//
|
||||||
|
#define SERVO0_PIN P2_00
|
||||||
|
|
||||||
|
//
|
||||||
|
// Limit Switches
|
||||||
|
//
|
||||||
|
#define X_STOP_PIN P1_29
|
||||||
|
#define Y_STOP_PIN P1_28
|
||||||
|
#define Z_STOP_PIN P1_27
|
||||||
|
|
||||||
|
//
|
||||||
|
// Z Probe (when not Z_MIN_PIN)
|
||||||
|
//
|
||||||
|
#ifndef Z_MIN_PROBE_PIN
|
||||||
|
#define Z_MIN_PROBE_PIN P0_10
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//
|
||||||
|
// Filament Runout Sensor
|
||||||
|
//
|
||||||
|
#define FIL_RUNOUT_PIN P1_26
|
||||||
|
#define FIL_RUNOUT2_PIN P1_25
|
||||||
|
|
||||||
|
//
|
||||||
|
// Power Supply Control
|
||||||
|
//
|
||||||
|
#ifndef PS_ON_PIN
|
||||||
|
#define PS_ON_PIN P1_00
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//
|
||||||
|
// Power Loss Detection
|
||||||
|
//
|
||||||
|
#ifndef POWER_LOSS_PIN
|
||||||
|
#define POWER_LOSS_PIN P1_00
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//
|
||||||
|
// Steppers
|
||||||
|
//
|
||||||
|
#define X_STEP_PIN P2_02
|
||||||
|
#define X_DIR_PIN P2_06
|
||||||
|
#define X_ENABLE_PIN P2_01
|
||||||
|
#ifndef X_CS_PIN
|
||||||
|
#define X_CS_PIN P1_10
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define Y_STEP_PIN P0_19
|
||||||
|
#define Y_DIR_PIN P0_20
|
||||||
|
#define Y_ENABLE_PIN P2_08
|
||||||
|
#ifndef Y_CS_PIN
|
||||||
|
#define Y_CS_PIN P1_09
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define Z_STEP_PIN P0_22
|
||||||
|
#define Z_DIR_PIN P2_11
|
||||||
|
#define Z_ENABLE_PIN P0_21
|
||||||
|
#ifndef Z_CS_PIN
|
||||||
|
#define Z_CS_PIN P1_08
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define E0_STEP_PIN P2_13
|
||||||
|
#define E0_DIR_PIN P0_11
|
||||||
|
#define E0_ENABLE_PIN P2_12
|
||||||
|
#ifndef E0_CS_PIN
|
||||||
|
#define E0_CS_PIN P1_04
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define E1_STEP_PIN P1_15
|
||||||
|
#define E1_DIR_PIN P1_14
|
||||||
|
#define E1_ENABLE_PIN P1_16
|
||||||
|
#ifndef E1_CS_PIN
|
||||||
|
#define E1_CS_PIN P1_01
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define TEMP_1_PIN P0_23_A0 // A2 (T2) - (69) - TEMP_1_PIN
|
||||||
|
#define TEMP_BED_PIN P0_25_A2 // A0 (T0) - (67) - TEMP_BED_PIN
|
||||||
|
|
||||||
|
//
|
||||||
|
// Include common SKR pins
|
||||||
|
//
|
||||||
|
#include "pins_BTT_SKR.h"
|
||||||
|
|
||||||
|
//
|
||||||
|
// Software SPI pins for TMC2130 stepper drivers
|
||||||
|
//
|
||||||
|
#if ENABLED(TMC_USE_SW_SPI)
|
||||||
|
#ifndef TMC_SW_MOSI
|
||||||
|
#define TMC_SW_MOSI P1_17
|
||||||
|
#endif
|
||||||
|
#ifndef TMC_SW_MISO
|
||||||
|
#define TMC_SW_MISO P0_05
|
||||||
|
#endif
|
||||||
|
#ifndef TMC_SW_SCK
|
||||||
|
#define TMC_SW_SCK P0_04
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if HAS_TMC220x
|
||||||
|
/**
|
||||||
|
* TMC2208/TMC2209 stepper drivers
|
||||||
|
*
|
||||||
|
* Hardware serial communication ports.
|
||||||
|
* If undefined software serial is used according to the pins below
|
||||||
|
*/
|
||||||
|
//#define X_HARDWARE_SERIAL Serial
|
||||||
|
//#define X2_HARDWARE_SERIAL Serial1
|
||||||
|
//#define Y_HARDWARE_SERIAL Serial1
|
||||||
|
//#define Y2_HARDWARE_SERIAL Serial1
|
||||||
|
//#define Z_HARDWARE_SERIAL Serial1
|
||||||
|
//#define Z2_HARDWARE_SERIAL Serial1
|
||||||
|
//#define E0_HARDWARE_SERIAL Serial1
|
||||||
|
//#define E1_HARDWARE_SERIAL Serial1
|
||||||
|
//#define E2_HARDWARE_SERIAL Serial1
|
||||||
|
//#define E3_HARDWARE_SERIAL Serial1
|
||||||
|
//#define E4_HARDWARE_SERIAL Serial1
|
||||||
|
|
||||||
|
//
|
||||||
|
// Software serial
|
||||||
|
//
|
||||||
|
#define X_SERIAL_TX_PIN P1_10
|
||||||
|
#define X_SERIAL_RX_PIN P1_10
|
||||||
|
|
||||||
|
#define Y_SERIAL_TX_PIN P1_09
|
||||||
|
#define Y_SERIAL_RX_PIN P1_09
|
||||||
|
|
||||||
|
#define Z_SERIAL_TX_PIN P1_08
|
||||||
|
#define Z_SERIAL_RX_PIN P1_08
|
||||||
|
|
||||||
|
#define E0_SERIAL_TX_PIN P1_04
|
||||||
|
#define E0_SERIAL_RX_PIN P1_04
|
||||||
|
|
||||||
|
#define E1_SERIAL_TX_PIN P1_01
|
||||||
|
#define E1_SERIAL_RX_PIN P1_01
|
||||||
|
|
||||||
|
#define Z2_SERIAL_TX_PIN P1_01
|
||||||
|
#define Z2_SERIAL_RX_PIN P1_01
|
||||||
|
|
||||||
|
// Reduce baud rate to improve software serial reliability
|
||||||
|
#define TMC_BAUD_RATE 19200
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//
|
||||||
|
// SD Connection
|
||||||
|
//
|
||||||
|
#if SD_CONNECTION_IS(LCD)
|
||||||
|
#define SS_PIN P0_16
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* _____ _____
|
||||||
|
* NC | · · | GND 5V | · · | GND
|
||||||
|
* RESET | · · | 1.31(SD_DETECT) (LCD_D7) 1.23 | · · | 1.22 (LCD_D6)
|
||||||
|
* (MOSI)0.18 | · · | 3.25(BTN_EN2) (LCD_D5) 1.21 | · · | 1.20 (LCD_D4)
|
||||||
|
* (SD_SS)0.16 | · · | 3.26(BTN_EN1) (LCD_RS) 1.19 | · · | 1.18 (LCD_EN)
|
||||||
|
* (SCK)0.15 | · · | 0.17(MISO) (BTN_ENC) 0.28 | · · | 1.30 (BEEPER)
|
||||||
|
* ----- -----
|
||||||
|
* EXP2 EXP1
|
||||||
|
*/
|
||||||
|
#if HAS_SPI_LCD
|
||||||
|
#define BTN_ENC P0_28 // (58) open-drain
|
||||||
|
|
||||||
|
#if ENABLED(CR10_STOCKDISPLAY)
|
||||||
|
#define LCD_PINS_RS P1_22
|
||||||
|
|
||||||
|
#define BTN_EN1 P1_18
|
||||||
|
#define BTN_EN2 P1_20
|
||||||
|
|
||||||
|
#define LCD_PINS_ENABLE P1_23
|
||||||
|
#define LCD_PINS_D4 P1_21
|
||||||
|
|
||||||
|
#else
|
||||||
|
#define LCD_PINS_RS P1_19
|
||||||
|
|
||||||
|
#define BTN_EN1 P3_26 // (31) J3-2 & AUX-4
|
||||||
|
#define BTN_EN2 P3_25 // (33) J3-4 & AUX-4
|
||||||
|
|
||||||
|
#define LCD_PINS_ENABLE P1_18
|
||||||
|
#define LCD_PINS_D4 P1_20
|
||||||
|
|
||||||
|
#define LCD_SDSS P0_16 // (16) J3-7 & AUX-4
|
||||||
|
#define SD_DETECT_PIN P1_31 // (49) (NOT 5V tolerant)
|
||||||
|
|
||||||
|
#if ENABLED(FYSETC_MINI_12864)
|
||||||
|
#define DOGLCD_CS P1_18
|
||||||
|
#define DOGLCD_A0 P1_19
|
||||||
|
#define DOGLCD_SCK P0_15
|
||||||
|
#define DOGLCD_MOSI P0_18
|
||||||
|
|
||||||
|
#define LCD_BACKLIGHT_PIN -1
|
||||||
|
|
||||||
|
#define FORCE_SOFT_SPI // Use this if default of hardware SPI causes display problems
|
||||||
|
// results in LCD soft SPI mode 3, SD soft SPI mode 0
|
||||||
|
|
||||||
|
#define LCD_RESET_PIN P1_20 // Must be high or open for LCD to operate normally.
|
||||||
|
|
||||||
|
#if EITHER(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0)
|
||||||
|
#ifndef RGB_LED_R_PIN
|
||||||
|
#define RGB_LED_R_PIN P1_21
|
||||||
|
#endif
|
||||||
|
#ifndef RGB_LED_G_PIN
|
||||||
|
#define RGB_LED_G_PIN P1_22
|
||||||
|
#endif
|
||||||
|
#ifndef RGB_LED_B_PIN
|
||||||
|
#define RGB_LED_B_PIN P1_23
|
||||||
|
#endif
|
||||||
|
#elif ENABLED(FYSETC_MINI_12864_2_1)
|
||||||
|
#define NEOPIXEL_PIN P1_21
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#else // !FYSETC_MINI_12864
|
||||||
|
|
||||||
|
#if ENABLED(MKS_MINI_12864)
|
||||||
|
#define DOGLCD_CS P1_21
|
||||||
|
#define DOGLCD_A0 P1_22
|
||||||
|
#define DOGLCD_SCK P0_15
|
||||||
|
#define DOGLCD_MOSI P0_18
|
||||||
|
#define FORCE_SOFT_SPI
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if ENABLED(ULTIPANEL)
|
||||||
|
#define LCD_PINS_D5 P1_21
|
||||||
|
#define LCD_PINS_D6 P1_22
|
||||||
|
#define LCD_PINS_D7 P1_23
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // !FYSETC_MINI_12864
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // HAS_SPI_LCD
|
||||||
|
|
||||||
|
//
|
||||||
|
// Neopixel LED
|
||||||
|
//
|
||||||
|
#ifndef NEOPIXEL_PIN
|
||||||
|
#define NEOPIXEL_PIN P1_24
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Special pins
|
||||||
|
* P1_30 (37) (NOT 5V tolerant)
|
||||||
|
* P1_31 (49) (NOT 5V tolerant)
|
||||||
|
* P0_27 (57) (Open collector)
|
||||||
|
* P0_28 (58) (Open collector)
|
||||||
|
*/
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue