Skip to content

Commit

Permalink
KasKas v0.0.1
Browse files Browse the repository at this point in the history
First clean edition of KasKas. History was quite the dumpsterfire.

- Pumps adequate amount of water when the moisture sensor detect dry
  soil
- Gives light to plants from the morning until the evening
- Heates the chamber to a nice and roasty 27.0C degrees through the day
  and leave it to cool off to 16.0C degrees at night.
- Ventilates the chamber according to a set moisture level
- Provides access to runtime variables via an RPC implementation over
  UART
- Provides timeseries data over the RPC
- Connects all GPIO and the various sensors/actuators through unified
  providers
  • Loading branch information
s-t-a-n committed Sep 23, 2024
0 parents commit 9a1935f
Show file tree
Hide file tree
Showing 61 changed files with 5,546 additions and 0 deletions.
105 changes: 105 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# this file was absolutely not stolen from a certain blue project
#
---
Language: Cpp
Standard: Latest
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignConsecutiveMacros: false
AlignEscapedNewlines: Right
AlignOperands: true
AlignTrailingComments: false
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Always
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: true
BinPackParameters: true
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeColon
PackConstructorInitializers: BinPack # edit
#PackConstructorInitializers: NextLineOnly #edit
BreakInheritanceList: BeforeColon
BreakStringLiterals: true
ColumnLimit: 120
CompactNamespaces: true
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DeriveLineEnding: true
DerivePointerAlignment: false
DisableFormat: false
#ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros: [ ]
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^<.*\..*>$'
Priority: 2
- Regex: '^<Q'
Priority: 3
- Regex: '^<'
Priority: 4
- Regex: '.*'
Priority: 1
IncludeIsMainRegex: ""
IncludeIsMainSourceRegex: ""
IndentCaseLabels: false
IndentGotoLabels: false
IndentPPDirectives: AfterHash
IndentWidth: 4
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ""
MacroBlockEnd: ""
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Left
RawStringFormats: [ ]
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInConditionalStatement: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
StatementMacros: [ ]
TabWidth: 4
UseCRLF: false
UseTab: Never
59 changes: 59 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Generated from CLion Inspection settings
---
Checks: '-*,
clang-diagnostic-*,
clang-analyzer-*,
cppcoreguidelines-*,
modernize-*,
-modernize-use-trailing-return-type,
-modernize-use-nodiscard,
bugprone-*,
performance-*,
cert-dcl21-cpp,
cert-dcl58-cpp,
cert-err34-c,
cert-err52-cpp,
cert-err60-cpp,
cert-flp30-c,
cert-msc50-cpp,
cert-msc51-cpp,
cert-str34-c,
google-default-arguments,
google-explicit-constructor,
google-runtime-operator,
hicpp-exception-baseclass,
hicpp-multiway-paths-covered,
misc-misplaced-const,
misc-new-delete-overloads,
misc-no-recursion,
misc-non-copyable-objects,
misc-throw-by-value-catch-by-reference,
misc-unconventional-assign-operator,
misc-uniqueptr-reset-release,
mpi-buffer-deref,
mpi-type-mismatch,
openmp-use-default-none,
portability-simd-intrinsics,
readability-avoid-const-params-in-decls,
readability-const-return-type,
readability-container-size-empty,
readability-convert-member-functions-to-static,
readability-delete-null-pointer,
readability-deleted-default,
readability-inconsistent-declaration-parameter-name,
readability-make-member-function-const,
readability-misleading-indentation,
readability-misplaced-array-index,
readability-non-const-parameter,
readability-redundant-control-flow,
readability-redundant-declaration,
readability-redundant-function-ptr-dereference,
readability-redundant-smartptr-get,
readability-redundant-string-cstr,
readability-redundant-string-init,
readability-simplify-subscript-expr,
readability-static-accessed-through-instance,
readability-static-definition-in-anonymous-namespace,
readability-string-compare,
readability-uniqueptr-delete-release,
readability-use-anyofallof'
9 changes: 9 additions & 0 deletions .github/commit_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[module]: Short description.

This commit adds:
- A

Related to PR#000

# Title: - Write in imperative form ('Add' not 'Adds/Added')
# - Keep title line below 50 characters
11 changes: 11 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## Why <!-- a short descripton of what this PR is trying to solve-->

## What <!-- a more detailed description -->

## Pay special attention to <!-- what should a codereviewer take into account -->

## Snippets/Screenshots <!-- If you have them, toss 'em here -->

## Checklist
- [ ] Your code should contain tests relevant for the problem you are solving
- [ ] If your code introduces new features or breaking change, add them to `changelog.md`
62 changes: 62 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: ci

on:
push:
branches: [ main, develop ]
pull_request:
types: [ opened, synchronize, reopened, ready_for_review ]
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Cache pip
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache PlatformIO
uses: actions/cache@v2
with:
path: ~/.platformio
key: ${{ runner.os }}-platformio-${{ hashFiles('**/platformio.ini') }}
restore-keys: |
${{ runner.os }}-platformio-
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: Install PlatformIO
run: |
python -m pip install --upgrade pip
pip install --upgrade platformio
- name: Build
run: pio run

- name: Static code analysis
run: pio check --fail-on-defect high

- name: Unittests
run: pio test -e unittest

linter:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
name: Format check.
steps:
- uses: actions/checkout@v2

- uses: DoozyX/clang-format-lint-action@v0.14
with:
source: './src'
extensions: 'h,hpp,c,cpp'
clangFormatVersion: 14
87 changes: 87 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: release

on:
push:
branches: [ main ]
tags:
- 'v*' # Trigger on version tag pushes (e.g., v1.0.0)

permissions:
contents: write

jobs:
build-and-package:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache PlatformIO
uses: actions/cache@v4
with:
path: ~/.platformio
key: ${{ runner.os }}-platformio-${{ hashFiles('**/platformio.ini') }}
restore-keys: |
${{ runner.os }}-platformio-
- name: Set up Python environment
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: Install PlatformIO
run: |
python -m pip install --upgrade pip
pip install platformio
- name: Build firmware (ELF and BIN)
run: |
for env in nucleo_f429zi nucleo_f429zi-debug; do
platformio run --environment $env
mkdir -p build_outputs
cp .pio/build/$env/firmware.elf build_outputs/firmware_$env.elf
cp .pio/build/$env/firmware.bin build_outputs/firmware_$env.bin
done
- name: Create firmware zip
run: |
mkdir -p release
cp -r build_outputs/* release/
zip -r release/firmware.zip release/*
- name: Create project archive
run: |
git archive --format=zip --output=release/project_release_${{ github.ref_name }}.zip HEAD
- name: Upload firmware zip
uses: actions/upload-artifact@v4
with:
name: firmware
path: release/firmware.zip

- name: Upload project release zip
uses: actions/upload-artifact@v3
with:
name: project_release_${{ github.ref_name }}
path: release/project_release_${{ github.ref_name }}.zip

- name: Create GitHub Release
if: github.event_name == 'push' && github.ref_type == 'tag' # Only run on tag push events
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
name: Release ${{ github.ref_name }}
draft: false
prerelease: false
files: |
release/firmware.zip
release/project_release_${{ github.ref_name }}.zip
Loading

0 comments on commit 9a1935f

Please sign in to comment.