Skip to content
Open
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
41 changes: 41 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Makefile for compiling Python files to .mpy files using mpy-cross

# Path to mpy-cross executable
MPY_CROSS = mpy-cross

# Define build directory
BUILD_DIR = build

# Additional Python files to compile (can be set from command line)
# Example: make EXTRA_PY_FILES="foo.py bar/baz.py"
EXTRA_PY_FILES ?=
EXTRA_MPY_FILES := $(patsubst %.py,$(BUILD_DIR)/%.mpy,$(EXTRA_PY_FILES))

# Python source directories
SRC_DIRS = manha

# Find all Python files in source directories
PY_FILES := $(shell find $(SRC_DIRS) -name "*.py")
# Generate corresponding .mpy file paths in build directory
MPY_FILES := $(patsubst %.py,$(BUILD_DIR)/%.mpy,$(PY_FILES)) $(EXTRA_MPY_FILES)

# Default target
all: build

# Build target
build: $(MPY_FILES)

# Rule to create .mpy files from .py files for full build
$(BUILD_DIR)/%.mpy: %.py
@mkdir -p $(dir $@)
$(MPY_CROSS) -o $@ $<

# Clean target
clean:
rm -rf $(BUILD_DIR)

# Create build directory
$(BUILD_DIR):
mkdir -p $@

.PHONY: all build clean
73 changes: 72 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,80 @@
# TM2Space MANHA Firmware
The repository is the firmware that powers the [MANHA](https://manha.tm2.space) kit from TM2Space. The MANHA OBC is powered by Raspberry Pico and Micro-python framework.

## Project Structure

The project is divided in the following structure:

```sh
$ tree manha

manha/ # Main source code directory
├── __init__.py # module export
├── gs/ # Ground Station implementation - ManhaGS
│ ├── __init__.py
│ └── gs.py
├── internals/ # Internal modules, drivers and utilities
│ ├── __init__.py
│ ├── comms/ # Communication modules
│ │ ├── __init__.py
│ │ ├── lora/ # LoRa communication
│ │ │ ├── __init__.py
│ │ │ └── lora.py
│ │ └── wifi/ # WiFi communication
│ │ ├── __init__.py
│ │ └── microdot/ # Microdot web framework
│ ├── drivers/ # Hardware drivers
│ │ ├── __init__.py
│ │ ├── adxl345.py # Accelerometer driver
│ │ ├── battery_adc.py # Battery ADC driver
│ │ ├── bme680.py # Environmental sensor driver
│ │ ├── ina219.py # Power monitor driver
│ │ ├── neogps.py # GPS driver
│ │ ├── rfm9x.py # LoRa RF module driver
│ │ ├── uvs12sd.py # UV sensor driver
│ │ └── ws2812matrix.py # LED matrix driver
│ └── parsers/
│ └── GPSParser.py # GPS NMEA data parser
└── satkit/ # Satellite kit modules
├── __init__.py
├── i2c.py # I2C utilities
├── index.html # Web interface
├── manha.py # Main satellite functionality
└── peripherals/ # Peripheral device abstractions
├── __init__.py
├── accelerometer.py
├── base.py
├── gas.py
├── gps.py
├── ledmatrix.py
├── powermon.py
└── uv.py

build/ # Compiled output directory
└── manha/
└── *.mpy # Compiled MicroPython files
```

## How to install
1. Clone the repository.
2. Open the repository on Thonny IDE.
3. Connect the MANHA OBC to the computer and select Pi Pico as the board on Thonny IDE.
4. Build the project as per [Building](#building)
5. Copy the `build/manha` folder to the detected Raspberry Pi Pico
6. Copy your `main.py` and any other files to the root of Raspberry Pi Pico

## Building
The firmware uses MicroPython's `.mpy` format for efficient execution on the Pico. To compile the Python files:

```bash
# install the mpy-cross compiler for .py to .mpy
pip3 install mpy-cross

# Compile all Python files to .mpy
make build

# Clean the build directory
make clean
```



61 changes: 0 additions & 61 deletions dotmatrix.py

This file was deleted.

12 changes: 0 additions & 12 deletions gs_comms.py

This file was deleted.

Loading