Support HW serial in v5, clean up config
This commit is contained in:
parent
351e5a6b7a
commit
0f4e4b5289
7 changed files with 44 additions and 36 deletions
|
|
@ -20,6 +20,12 @@ lib_deps =
|
|||
waspinator/AccelStepper@^1.61
|
||||
lib_ldf_mode = chain
|
||||
|
||||
[env:uno]
|
||||
platform = atmelavr
|
||||
board = uno
|
||||
build_flags = -D MCU_UNO
|
||||
|
||||
|
||||
[env:nano]
|
||||
platform = atmelavr
|
||||
board = nanoatmega328new
|
||||
|
|
@ -42,14 +48,14 @@ platform = ststm32
|
|||
board = bluepill_f103c8
|
||||
upload_protocol = stlink
|
||||
build_flags =
|
||||
-D MCU_BLUEPILL
|
||||
-D PIO_FRAMEWORK_ARDUINO_ENABLE_CDC
|
||||
-D USBCON
|
||||
-D USBD_VID=0x0483
|
||||
-D USBD_PID=0x5740
|
||||
-D USB_MANUFACTURER="Unknown"
|
||||
-D USB_PRODUCT="\"BLUEPILL_F103C8\""
|
||||
-D HAL_PCD_MODULE_ENABLED
|
||||
-D MCU_BLUEPILL
|
||||
-D PIO_FRAMEWORK_ARDUINO_ENABLE_CDC
|
||||
-D USBCON
|
||||
-D USBD_VID=0x0483
|
||||
-D USBD_PID=0x5740
|
||||
-D USB_MANUFACTURER="Unknown"
|
||||
-D USB_PRODUCT="\"BLUEPILL_F103C8\""
|
||||
-D HAL_PCD_MODULE_ENABLED
|
||||
|
||||
[env:esp32]
|
||||
platform = espressif32
|
||||
|
|
|
|||
19
src/boards.h
19
src/boards.h
|
|
@ -9,6 +9,8 @@
|
|||
#define BOARD_SANGABOARDv5
|
||||
#elif defined(MCU_ESP32)
|
||||
#define BOARD_CUSTOM_ESP32
|
||||
#elif defined(MCU_UNO)
|
||||
#define BOARD_CUSTOM
|
||||
#else
|
||||
#error "Invalid build config - must specify MCU type"
|
||||
#endif
|
||||
|
|
@ -23,6 +25,7 @@
|
|||
#define ENDSTOPS_PULLUPS true
|
||||
#define WIRING_ENDSTOPS_MIN {A0,A1,A2}
|
||||
#define WIRING_ENDSTOPS_MAX {A3,A4,A5}
|
||||
#define SERIAL_PORT Serial
|
||||
#elif defined(BOARD_SANGABOARDv2)
|
||||
#define BOARD_STRING "Sangaboard v0.2"
|
||||
#define WIRING_MOTOR_X 13, 12, 11, 10
|
||||
|
|
@ -32,6 +35,7 @@
|
|||
#define ENDSTOPS_PULLUPS true
|
||||
#define WIRING_ENDSTOPS_MIN {A0,A1,A2}
|
||||
#define WIRING_ENDSTOPS_MAX {A3,A4,A5}
|
||||
#define SERIAL_PORT Serial
|
||||
#elif defined(BOARD_CUSTOM_BLUEPILL)
|
||||
#define BOARD_STRING "Custom Bluepill board"
|
||||
#define WIRING_MOTOR_X PB11, PB10, PB1, PB0
|
||||
|
|
@ -41,6 +45,7 @@
|
|||
#define ENDSTOPS_PULLUPS true
|
||||
#define WIRING_ENDSTOPS_MIN {A0,A1,A2}
|
||||
#define WIRING_ENDSTOPS_MAX {A3,A4,A5}
|
||||
#define SERIAL_PORT Serial
|
||||
#elif defined(BOARD_CUSTOM_PICO)
|
||||
#define BOARD_STRING "Custom Pico board"
|
||||
#define WIRING_MOTOR_X 2, 3, 4, 5
|
||||
|
|
@ -54,6 +59,7 @@
|
|||
#define WIRING_ADDITIONAL_STEPPERS = {{0, 1, 22, 23}}
|
||||
#define WIRING_STEPSTICK {13,14,15} //enable, step, dir todo: move to boards.h
|
||||
//TODO: illumination, 4th motor wiring
|
||||
#define SERIAL_PORT Serial
|
||||
#elif defined(BOARD_SANGABOARDv5)
|
||||
#define BOARD_STRING "Sangaboard v0.5"
|
||||
#define WIRING_MOTOR_X 2, 3, 4, 5
|
||||
|
|
@ -66,7 +72,14 @@
|
|||
#define ADDITIONAL_STEPPERS 1
|
||||
#define WIRING_ADDITIONAL_STEPPERS = {{0, 1, 22, 23}}
|
||||
#define WIRING_STEPSTICK {23,22,1} //enable, step, dir todo: move to boards.h
|
||||
//TODO: illumination, 4th motor wiring
|
||||
#define WIRING_SERIAL_TX 8
|
||||
#define WIRING_SERIAL_RX 9
|
||||
#ifdef USB_SERIAL
|
||||
#define SERIAL_PORT Serial
|
||||
#else
|
||||
#define SERIAL_PORT Serial2
|
||||
#endif
|
||||
//TODO: move illumination wiring here, 4th motor support
|
||||
#elif defined(BOARD_CUSTOM_ESP32)
|
||||
#define BOARD_STRING "Custom ESP32 board"
|
||||
#define WIRING_MOTOR_X 34, 32, 25, 27
|
||||
|
|
@ -77,8 +90,9 @@
|
|||
#define WIRING_ENDSTOPS_MIN {A0,A1,A2}
|
||||
#define WIRING_ENDSTOPS_MAX {A3,A4,A5}
|
||||
#define WIRING_STEPSTICK {13,12,27}
|
||||
#define SERIAL_PORT Serial
|
||||
#elif defined(BOARD_CUSTOM)
|
||||
#define BOARD_STRING "Sangaboard v0.5"
|
||||
#define BOARD_STRING "Custom board"
|
||||
#define WIRING_MOTOR_X 2, 3, 4, 5
|
||||
#define WIRING_MOTOR_Y 2, 3, 4, 5
|
||||
#define WIRING_MOTOR_Z 2, 3, 4, 5
|
||||
|
|
@ -89,4 +103,5 @@
|
|||
#define ADDITIONAL_STEPPERS 1
|
||||
#define WIRING_ADDITIONAL_STEPPERS = {{0, 1, 22, 23}}
|
||||
#define WIRING_STEPSTICK {8,9,10} //enable, step, dir todo: move to boards.h
|
||||
#define SERIAL_PORT Serial
|
||||
#endif
|
||||
17
src/config.h
17
src/config.h
|
|
@ -1,24 +1,19 @@
|
|||
#ifndef CONFIGURED
|
||||
//board choice
|
||||
//#define BOARD_AUTO
|
||||
//#define BOARD_SANGABOARDv3
|
||||
//#define BOARD_SANGABOARDv2
|
||||
#define BOARD_SANGABOARDv5
|
||||
//#define BOARD_CUSTOM_ESP32
|
||||
//#define BOARD_CUSTOM_PICO
|
||||
#define BOARD_AUTO
|
||||
//#define BOARD_SANGABOARDv5
|
||||
|
||||
//default to USB serial for now
|
||||
//#define SERIAL_PORT PiSerial
|
||||
#define SERIAL_PORT Serial
|
||||
//without this, default to HW serial where available
|
||||
//the details are board specific and configured in boards.h
|
||||
//#define USB_SERIAL
|
||||
|
||||
//#define BOARD_CUSTOM
|
||||
#include <boards.h> //defines wiring
|
||||
|
||||
//general settings
|
||||
#define MAX_COMMANDS 50
|
||||
#define MAX_MODULES 10
|
||||
#define MAX_ARGUMENT_LENGTH 20 //used in argument parsing, takes up ram
|
||||
#define VERSION_STRING "Sangaboard Firmware v0.4" //temporary hack
|
||||
#define VERSION_STRING "Sangaboard Firmware v1.0-beta"
|
||||
#define DEBUG_ON
|
||||
|
||||
//module choice
|
||||
|
|
|
|||
10
src/main.cpp
10
src/main.cpp
|
|
@ -44,10 +44,6 @@
|
|||
#include "modules/light_sensor/light_sensor.h"
|
||||
#endif
|
||||
|
||||
#ifdef BOARD_SANGABOARDv5
|
||||
//arduino::UART PiSerial(8, 9, NC, NC); //TODO this shouldn't be here
|
||||
#endif
|
||||
|
||||
const Command *registered_commands[MAX_COMMANDS];
|
||||
void (*registered_loop_functions[MAX_MODULES])(void);
|
||||
|
||||
|
|
@ -140,7 +136,11 @@ void get_modules(String)
|
|||
void setup()
|
||||
{
|
||||
// initialise serial port
|
||||
//SERIAL_PORT.begin(115200);
|
||||
#ifdef WIRING_SERIAL_TX
|
||||
Serial2.setTX(WIRING_SERIAL_TX);
|
||||
Serial2.setRX(WIRING_SERIAL_RX);
|
||||
#endif
|
||||
|
||||
SERIAL_PORT.begin(115200);
|
||||
while (!SERIAL_PORT)
|
||||
delay(1);
|
||||
|
|
|
|||
|
|
@ -13,12 +13,6 @@
|
|||
}
|
||||
#define CHECK_END_COMMAND(C) check_end_command(C)
|
||||
|
||||
//TODO: temporarily disabled for philhower compatibilty
|
||||
//extern arduino::UART PiSerial;
|
||||
|
||||
#ifdef BOARD_SANGABOARDv5
|
||||
#endif
|
||||
|
||||
struct Command
|
||||
{
|
||||
const char * command;
|
||||
|
|
|
|||
|
|
@ -9,11 +9,10 @@
|
|||
|
||||
#define PWM_NUM 1
|
||||
#define WIRING_PWM_LEDS {25}
|
||||
//TODO: implement some fancier features of TMC controllers
|
||||
|
||||
const uint8_t pwm_led_pins[] = WIRING_PWM_LEDS;
|
||||
void illumination_pwm_freq(String command)
|
||||
{
|
||||
//TODO: make this properly, this is just a test for hacked on/off
|
||||
char * args[1];
|
||||
parse_arguments(args, command, 2);
|
||||
#ifdef MCU_PICO
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
#include "config.h"
|
||||
#define STEPSTICK //TODO: remove
|
||||
#ifdef STEPSTICK
|
||||
#include "stepstick.h"
|
||||
#ifdef SUPPORT_EEPROM
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue