Skip to content

Commit

Permalink
Added 6pack v2 board, fixes for v1 definitions - from PR #103.
Browse files Browse the repository at this point in the history
Added driver support for max limit switches and missing init for e-stop input.
Updated for core change related to the RGB HAL.
  • Loading branch information
terjeio committed Mar 19, 2024
1 parent 0331dc8 commit f26f210
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 49 deletions.
4 changes: 3 additions & 1 deletion main/boards/xPro_v5_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Part of grblHAL
Copyright (c) 2021-2022 Terje Io
Copyright (c) 2021-2024 Terje Io
grblHAL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -35,6 +35,8 @@
#error BOARD_XPRO_V5 has soldered TMC5160 drivers.
#endif

#define TRINAMIC_MIXED_DRIVERS 0

// timer definitions
#define STEP_TIMER_GROUP TIMER_GROUP_0
#define STEP_TIMER_INDEX TIMER_0
Expand Down
37 changes: 21 additions & 16 deletions main/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -2014,25 +2014,25 @@ static void settings_changed (settings_t *settings, settings_changed_flags_t cha

#ifdef NEOPIXELS_PIN

if(neopixel.leds == NULL || hal.rgb.num_devices != settings->rgb_strip0_length) {
if(neopixel.leds == NULL || hal.rgb0.num_devices != settings->rgb_strip0_length) {

if(settings->rgb_strip0_length == 0)
settings->rgb_strip0_length = hal.rgb.num_devices;
settings->rgb_strip0_length = hal.rgb0.num_devices;
else
hal.rgb.num_devices = settings->rgb_strip0_length;
hal.rgb0.num_devices = settings->rgb_strip0_length;

if(neopixel.leds) {
free(neopixel.leds);
neopixel.leds = NULL;
}

if(hal.rgb.num_devices) {
neopixel.num_bytes = hal.rgb.num_devices * 3;
if(hal.rgb0.num_devices) {
neopixel.num_bytes = hal.rgb0.num_devices * 3;
if((neopixel.leds = calloc(neopixel.num_bytes, sizeof(uint8_t))) == NULL)
hal.rgb.num_devices = 0;
hal.rgb0.num_devices = 0;
}

neopixel.num_leds = hal.rgb.num_devices;
neopixel.num_leds = hal.rgb0.num_devices;
}

#endif
Expand Down Expand Up @@ -2122,6 +2122,11 @@ static void settings_changed (settings_t *settings, settings_changed_flags_t cha
signal->mode.inverted = control_fei.reset;
break;

case Input_EStop:
signal->mode.pull_mode = settings->control_disable_pullup.e_stop ? PullMode_Down : PullMode_Up;
signal->mode.inverted = control_fei.e_stop;
break;

case Input_FeedHold:
signal->mode.pull_mode = settings->control_disable_pullup.feed_hold ? PullMode_Down : PullMode_Up;
signal->mode.inverted = control_fei.feed_hold;
Expand Down Expand Up @@ -2744,8 +2749,8 @@ static bool driver_setup (settings_t *settings)
enet_start();
#endif

// if(hal.rgb.out)
// hal.rgb.out(0, (rgb_color_t){ .R = 5, .G = 100, .B = 5 });
// if(hal.rgb0.out)
// hal.rgb0.out(0, (rgb_color_t){ .R = 5, .G = 100, .B = 5 });

return IOInitDone;
}
Expand Down Expand Up @@ -2802,7 +2807,7 @@ bool driver_init (void)
#else
hal.info = "ESP32";
#endif
hal.driver_version = "240304";
hal.driver_version = "240310";
hal.driver_url = GRBL_URL "/ESP32";
#ifdef BOARD_NAME
hal.board = BOARD_NAME;
Expand Down Expand Up @@ -3060,12 +3065,12 @@ bool driver_init (void)
// Initialize automatic timing translator
rmt_translator_init(neo_config.channel, ws2812_rmt_adapter);

hal.rgb.out = neopixel_out;
hal.rgb.out_masked = neopixel_out_masked;
hal.rgb.write = neopixels_write;
hal.rgb.set_intensity = neopixels_set_intensity;
hal.rgb.num_devices = NEOPIXELS_NUM;
hal.rgb.cap = (rgb_color_t){ .R = 255, .G = 255, .B = 255 };
hal.rgb0.out = neopixel_out;
hal.rgb0.out_masked = neopixel_out_masked;
hal.rgb0.write = neopixels_write;
hal.rgb0.set_intensity = neopixels_set_intensity;
hal.rgb0.num_devices = NEOPIXELS_NUM;
hal.rgb0.cap = (rgb_color_t){ .R = 255, .G = 255, .B = 255 };

const periph_pin_t neopixels = {
.function = Output_LED_Adressable,
Expand Down
16 changes: 8 additions & 8 deletions main/driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,6 @@ static const DRAM_ATTR float FZERO = 0.0f;

// End configuration

#if TRINAMIC_ENABLE
#ifndef TRINAMIC_MIXED_DRIVERS
#define TRINAMIC_MIXED_DRIVERS 1
#endif
#include "motors/trinamic.h"
#include "trinamic/common.h"
#endif

typedef struct {
uint8_t action;
uint_fast16_t address;
Expand Down Expand Up @@ -199,6 +191,14 @@ extern SemaphoreHandle_t i2cBusy;
#error "I2C port not available!"
#endif

#if TRINAMIC_ENABLE
#ifndef TRINAMIC_MIXED_DRIVERS
#define TRINAMIC_MIXED_DRIVERS 1
#endif
#include "motors/trinamic.h"
#include "trinamic/common.h"
#endif

#if USB_SERIAL_CDC
#define SP0 1
#else
Expand Down
48 changes: 24 additions & 24 deletions main/my_machine.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,32 +19,32 @@

// NOTE: Only one board may be enabled!
// If none is enabled pin mappings from generic_map.h will be used
//#define BOARD_BDRING_V3P5 //
//#define BOARD_BDRING_V4 //
//#define BOARD_BDRING_I2S6A //
//#define BOARD_BDRING_6X //
#define BOARD_BDRING_I2S_6PACK_EXT_V2 //
//#define BOARD_ESPDUINO32 //
//#define BOARD_SOURCERABBIT_4AXIS //
//#define BOARD_PROTONEER_3XX //
//#define BOARD_FYSETC_E4 //
//#define BOARD_XPRO_V5 //
//#define BOARD_MKS_DLC32_V2P0 //
//#define BOARD_MKS_TINYBEE_V1 //
//#define BOARD_CNC3040 //
//#define BOARD_BLACKBOX_X32 // NOTE: Enable in CMakeLists.txt to set board specific defaults for the core!
//#define BOARD_ROOTCNC_V2 //
//#define BOARD_ROOTCNC_V3 //
//#define BOARD_CNC_BOOSTERPACK //
//#define BOARD_GENERIC_I2S_S3 // Generic map for ESP32-S3 with I2S shift registers for I/O expansion
//#define BOARD_MY_MACHINE // Add my_machine_map.h in the boards directory before enabling this!
//#define BOARD_BDRING_V3P5 //
//#define BOARD_BDRING_V4 //
//#define BOARD_BDRING_I2S6A //
//#define BOARD_BDRING_6X //
//#define BOARD_BDRING_I2S_6PACK_EXT_V2 //
//#define BOARD_ESPDUINO32 //
//#define BOARD_SOURCERABBIT_4AXIS //
//#define BOARD_PROTONEER_3XX //
//#define BOARD_FYSETC_E4 //
//#define BOARD_XPRO_V5 //
//#define BOARD_MKS_DLC32_V2P0 //
//#define BOARD_MKS_TINYBEE_V1 //
//#define BOARD_CNC3040 //
//#define BOARD_BLACKBOX_X32 // NOTE: Enable in CMakeLists.txt to set board specific defaults for the core!
//#define BOARD_ROOTCNC_V2 //
//#define BOARD_ROOTCNC_V3 //
//#define BOARD_CNC_BOOSTERPACK //
//#define BOARD_GENERIC_I2S_S3 // Generic map for ESP32-S3 with I2S shift registers for I/O expansion
//#define BOARD_MY_MACHINE // Add my_machine_map.h in the boards directory before enabling this!
//#define BOARD_BLOX
// Configuration
// Uncomment to enable, for some a value > 1 may be assigned, if so the default value is shown.

// #if CONFIG_IDF_TARGET_ESP32S3
// #define USB_SERIAL_CDC 1 // Serial communication via native USB.
// #endif
#if CONFIG_IDF_TARGET_ESP32S3
#define USB_SERIAL_CDC 1 // Serial communication via native USB.
#endif

// Spindle selection:
// Up to four specific spindle drivers can be instantiated at a time
Expand Down Expand Up @@ -102,7 +102,7 @@
// of axes can be enabled here.
//#define X_GANGED 1
//#define X_AUTO_SQUARE 1
#define Y_GANGED 1
//#define Y_GANGED 1
//#define Y_AUTO_SQUARE 1
//#define Z_GANGED 1
//#define Z_AUTO_SQUARE 1
Expand All @@ -126,7 +126,7 @@
//#define WEBDAV_ENABLE 1 // webdav protocol - requires http daemon and SD card enabled.
#endif
// The following symbols have the default values as shown, uncomment and change as needed.
//#define NETWORK_STA_HOSTNAME "grblHAL_6x"
//#define NETWORK_STA_HOSTNAME "grblHAL"
//#define NETWORK_STA_IPMODE 1 // 0 = static, 1 = DHCP, 2 = AutoIP
//#define NETWORK_STA_IP "192.168.5.1"
//#define NETWORK_STA_GATEWAY "192.168.5.1"
Expand Down
1 change: 1 addition & 0 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ build_flags =
; -DY_AUTO_SQUARE=1
; -DDRIVER_SPINDLE_PWM_ENABLE=1
; -DSDCARD_ENABLE=2
-DNETWORK_STA_HOSTNAME=grblHAL_6x
-DPROBE_ENABLE=1
-DPROBE_PIN=GPIO_NUM_2

Expand Down

0 comments on commit f26f210

Please sign in to comment.