Skip to content
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
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PYSQUARED_VERSION ?= v2.0.0-alpha-25w14-3
PYSQUARED_VERSION ?= sx1280-manager
PYSQUARED ?= git+https://github.com/proveskit/pysquared@$(PYSQUARED_VERSION)

.PHONY: all
Expand Down Expand Up @@ -51,6 +51,11 @@ else
$(call rsync_to_dest,artifacts/proves,$(BOARD_MOUNT_POINT))
endif

# install-firmware
.PHONY: install-firmware
install-firmware: uv ## Install the board firmware onto a connected PROVES Kit
@$(UVX) --from git+https://github.com/proveskit/[email protected] install-firmware v5a

.PHONY: clean
clean: ## Remove all gitignored files such as downloaded libraries and artifacts
git clean -dfX
Expand Down
7 changes: 4 additions & 3 deletions lib/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
adafruit-circuitpython-74hc595==1.4.6
adafruit-circuitpython-ina219==3.4.26
adafruit-circuitpython-asyncio @ git+https://github.com/adafruit/[email protected]
adafruit-circuitpython-drv2605==1.3.4
adafruit-circuitpython-lis2mdl==2.1.23
Expand All @@ -7,8 +7,9 @@ adafruit-circuitpython-mcp9808==3.3.24
adafruit-circuitpython-neopixel==6.3.12
adafruit-circuitpython-register==1.10.1
adafruit-circuitpython-rfm==1.0.3
adafruit-circuitpython-tca9548a @ git+https://github.com/proveskit/Adafruit_CircuitPython_TCA9548A@1.0.0
adafruit-circuitpython-tca9548a @ git+https://github.com/proveskit/Adafruit_CircuitPython_TCA9548A@1.1.0
adafruit-circuitpython-ticks==1.1.1
adafruit-circuitpython-veml7700==2.0.2
Adafruit_CircuitPython_MCP230xx
proves-circuitpython-rv3028 @ git+https://github.com/proveskit/[email protected]
proves-circuitpython-sx126 @ git+https://github.com/proveskit/micropySX126X@1.0.0
proves-circuitpython-sx1280 @ git+https://github.com/proveskit/CircuitPython_SX1280@1.0.3
68 changes: 40 additions & 28 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,19 @@
# Created By: Michael Pham

"""
Built for the PySquared FC Board
Version: 2.0.0
Published: Nov 19, 2024
Built for the PySquared V5a FC Board
Version: X.X.X
Published:
"""

import gc
import os
import time

import board
import digitalio
import microcontroller

try:
# from board_definitions import proveskit_rp2040_v4 as board
raise ImportError
except ImportError:
import board

import os

import lib.pysquared.functions as functions
import lib.pysquared.nvm.register as register
from lib.pysquared.cdh import CommandDataHandler
Expand All @@ -30,7 +24,7 @@
from lib.pysquared.hardware.digitalio import initialize_pin
from lib.pysquared.hardware.imu.manager.lsm6dsox import LSM6DSOXManager
from lib.pysquared.hardware.magnetometer.manager.lis2mdl import LIS2MDLManager
from lib.pysquared.hardware.radio.manager.sx126x import SX126xManager
from lib.pysquared.hardware.radio.manager.sx1280 import SX1280Manager
from lib.pysquared.logger import Logger
from lib.pysquared.nvm.counter import Counter
from lib.pysquared.nvm.flag import Flag
Expand All @@ -43,7 +37,7 @@
rtc = MicrocontrollerManager()

logger: Logger = Logger(
error_counter=Counter(index=register.ERRORCNT, datastore=microcontroller.nvm),
error_counter=Counter(index=register.ERRORCNT),
colorized=False,
)

Expand All @@ -68,38 +62,58 @@

# TODO(nateinaction): fix spi init
spi0 = _spi_init(
logger,
board.SPI0_SCK,
board.SPI0_MOSI,
board.SPI0_MISO,
)

spi1 = _spi_init(
logger,
board.SPI1_SCK,
board.SPI1_MOSI,
board.SPI1_MISO,
)

radio = SX126xManager(
use_fsk_flag = Flag(index=register.FLAG, bit_index=7)

radio = SX1280Manager(
logger,
config.radio,
Flag(index=register.FLAG, bit_index=7, datastore=microcontroller.nvm),
spi0,
initialize_pin(logger, board.SPI0_CS0, digitalio.Direction.OUTPUT, True),
board.RF2_IO0,
initialize_pin(logger, board.RF1_RST, digitalio.Direction.OUTPUT, True),
board.RF2_IO4,
use_fsk_flag,
spi1,
initialize_pin(logger, board.SPI1_CS0, digitalio.Direction.OUTPUT, True),
initialize_pin(logger, board.RF2_RST, digitalio.Direction.OUTPUT, True),
initialize_pin(logger, board.RF2_IO0, digitalio.Direction.OUTPUT, True),
2.4,
initialize_pin(logger, board.RF2_TX_EN, digitalio.Direction.OUTPUT, True),
initialize_pin(logger, board.RF2_RX_EN, digitalio.Direction.OUTPUT, True),
)

i2c1 = initialize_i2c_bus(
logger,
board.I2C1_SCL,
board.I2C1_SDA,
board.SCL1,
board.SDA1,
100000,
)

magnetometer = LIS2MDLManager(logger, i2c1)

imu = LSM6DSOXManager(logger, i2c1, 0x6B)

c = Satellite(logger, config)

sleep_helper = SleepHelper(c, logger, watchdog)

# radio = RFM9xManager(
# logger,
# config.radio,
# Flag(index=register.FLAG, bit_index=7),
# spi0,
# initialize_pin(logger, board.SPI0_CS0, digitalio.Direction.OUTPUT, True),
# initialize_pin(logger, board.RF1_RST, digitalio.Direction.OUTPUT, True),
# )

magnetometer = LIS2MDLManager(logger, i2c1)

imu = LSM6DSOXManager(logger, i2c1, 0x6B)

cdh = CommandDataHandler(config, logger, radio)

f = functions.functions(
Expand Down Expand Up @@ -156,9 +170,7 @@ def main():

f.listen_loiter()

f.all_face_data()
watchdog.pet()
f.send_face()

f.listen_loiter()

Expand Down
50 changes: 15 additions & 35 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,51 +1,31 @@
[project]
name = "circuitpy-flight-software"
version = "2.0.0"
description = "Flight Software for the PROVES Kit"
name = "proveskit-rp2350-v5a"
version = "1.0.0"
description = "Flight Software for the PROVES Kit RP2350 v5A"
readme = "README.md"
requires-python = ">=3.13"
dependencies = [
"adafruit-circuitpython-typing==1.11.2",
"circuitpython-stubs==9.2.5",
"coverage==7.6.10",
"pre-commit==4.0.1",
"pyright[nodejs]==1.1.399",
"pytest==8.3.2",
]

[tool.ruff.format]
# Use `\n` line endings for all files
line-ending = "lf"

[tool.pytest.ini_options]
pythonpath = "."
markers = [
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
[tool.pyright]
include = ["main.py", "boot.py", "repl.py", "safemode.py"]
exclude = [
"**/__pycache__",
".venv",
".git",
"artifacts",
"lib",
"typings",
]

[tool.coverage.run]
branch = true
relative_files = true

[tool.coverage.report]
show_missing = true
skip_covered = false
include = [
"lib/**/*.py",
"boot.py",
"main.py",
"repl.py",
"safemode.py",
]
omit = [
"lib/adafruit_*/**",
"lib/asyncio_*/**",
"lib/rv3028*/**",
"lib/neopixel.py",
"lib/pysquared/**"
]

[tool.coverage.html]
directory = ".coverage-reports/html"

[tool.coverage.xml]
output = ".coverage-reports/coverage.xml"
stubPath = "./typings"
reportMissingModuleSource = false
Loading