Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use the BoardEnv.txt to enable spi on CB1 #74

Merged
merged 1 commit into from
May 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/armbian/CB1
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ export BASE_IMAGE_RESIZEROOT
export DOWNLOAD_URL_CHECKSUM
export DOWNLOAD_URL_IMAGE

export MODULES="base,deb_namserver,passwordless_sudo,pkgupgrade(network,cb1config,klipper,node,is_req_preinstall,moonraker,opiconfig,ratos(mainsail,crowsnest,linear_movement_analysis,timelapse,klipperscreen,rpi_mcu,disable-services(hotspot_cb1),dfu-util),password-for-sudo),postrename"
export MODULES="base,deb_namserver,passwordless_sudo,pkgupgrade(network,cb1config,klipper,node,is_req_preinstall,moonraker,cb1spi,ratos(mainsail,crowsnest,linear_movement_analysis,timelapse,klipperscreen,rpi_mcu,disable-services(hotspot_cb1),dfu-util),password-for-sudo),postrename"
8 changes: 8 additions & 0 deletions src/modules/cb1spi/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
#### CB1SPI - CB1 Configuration Module

# Shebang for better file detection
# shellcheck disable=all

[ -n "$CB1SPI_CONFIG_TXT_FILE" ] || CB1SPI_CONFIG_TXT_FILE="/boot/BoardEnv.txt"
[ -n "$CB1SPI_CONFIG_BAK_FILE" ] || CB1SPI_CONFIG_BAK_FILE="/boot/BoardEnv.txt.backup"
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
#### opiconfig - SB1 Configuration Module
#### CB1SPI - SB1 Configuration Module
#from https://www.reddit.com/r/BIGTREETECH/comments/xfom6n/comment/it32e6v/

# shellcheck enable=require-variable-braces
Expand All @@ -17,15 +17,12 @@ fi
source /common.sh
install_cleanup_trap

echo_green "Enable SPI interface on Orange Pi SBC's ..."
echo_green "Enable SPI interface on CB1 SBC's ..."

# Step 1: Copy default config to backup file
cp "${OPICONFIG_CONFIG_TXT_FILE}" "${OPICONFIG_CONFIG_BAK_FILE}"
cp "${CB1SPI_CONFIG_TXT_FILE}" "${CB1SPI_CONFIG_BAK_FILE}"

# Step 2: Enable SPI
echo "overlays=spi" >> "${OPICONFIG_CONFIG_TXT_FILE}"
echo "spidevparam_spidev_spi_bus=1" >> "${OPICONFIG_CONFIG_TXT_FILE}"
echo "param_spidev_spi_cs=1" >> "${OPICONFIG_CONFIG_TXT_FILE}"
echo "param_spidev_max_freq=1000000" >> "${OPICONFIG_CONFIG_TXT_FILE}"
sed -i 's/^#overlays=spidev1_2.*/overlays=spidev1_2/' "${CB1SPI_CONFIG_TXT_FILE}"

echo_green "Enable SPI interface on SB1 ... DONE!"
echo_green "Enable SPI interface on CB1 SBC ... DONE!"
8 changes: 0 additions & 8 deletions src/modules/opiconfig/config

This file was deleted.