Skip to content

Commit

Permalink
Merge branch 'development' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
ClemensElflein committed Sep 26, 2022
2 parents 39c12b3 + fd6a5fc commit 3378c06
Show file tree
Hide file tree
Showing 42 changed files with 1,333 additions and 203 deletions.
112 changes: 112 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: CI

on: [push]

jobs:
erc-drc-checks:
runs-on: ubuntu-latest
if: github.ref_type != 'tag'
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: INTI-CMNB/KiBot@v2_k6
with:
config: Hardware/OpenMowerMainboard/OpenMowerMainboard.kibot.yaml
board: Hardware/OpenMowerMainboard/OpenMowerMainboard.kicad_pcb
verbose: 1

firmware:
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 }}-${{ hashFiles('**/lockfiles') }}
- name: Set up Python
uses: actions/setup-python@v2
- name: Install PlatformIO
run: |
python -m pip install --upgrade pip
pip install --upgrade platformio
- name: Run PlatformIO
run: pio run -d Firmware/LowLevel
- name: Copy Artifacts
run: |
mkdir artifacts
mkdir ./artifacts/ELFLEIN_PROTOTYPE
cp Firmware/LowLevel/.pio/build/ELFLEIN_PROTOTYPE/firmware.elf ./artifacts/ELFLEIN_PROTOTYPE
cp Firmware/LowLevel/.pio/build/ELFLEIN_PROTOTYPE/firmware.uf2 ./artifacts/ELFLEIN_PROTOTYPE
mkdir ./artifacts/MPU9250
cp Firmware/LowLevel/.pio/build/MPU9250/firmware.elf ./artifacts/MPU9250
cp Firmware/LowLevel/.pio/build/MPU9250/firmware.uf2 ./artifacts/MPU9250
mkdir ./artifacts/WT901_INSTEAD_OF_SOUND
cp Firmware/LowLevel/.pio/build/WT901_INSTEAD_OF_SOUND/firmware.elf ./artifacts/WT901_INSTEAD_OF_SOUND
cp Firmware/LowLevel/.pio/build/WT901_INSTEAD_OF_SOUND/firmware.uf2 ./artifacts/WT901_INSTEAD_OF_SOUND
- name: Step 3 - Use the Upload Artifact GitHub Action
uses: actions/upload-artifact@v3
with:
name: open-mower-pico-firmware
path: artifacts/

tagged-release:
runs-on: ubuntu-latest
if: github.ref_type == 'tag' && startsWith(github.ref_name, 'v')
needs: firmware
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: INTI-CMNB/KiBot@v2_k6
with:
config: Hardware/OpenMowerMainboard/OpenMowerMainboard.kibot.yaml
board: Hardware/OpenMowerMainboard/OpenMowerMainboard.kicad_pcb
skip: run_drc,run_erc

- name: 'Fix permissions on release/'
run: sudo chmod 0777 release

- uses: actions/download-artifact@v3
with:
name: open-mower-pico-firmware
path: firmware

- name: Create firmware zip
run: zip -r release/firmware.zip firmware

- uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
files: release/*

- name: Deploy release
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: release
destination_dir: release

- name: Deploy release_navigator
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: release_navigator
destination_dir: release_navigator
keep_files: true

- name: Deploy release_navigator index
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: release_navigator
keep_files: true
17 changes: 0 additions & 17 deletions .github/workflows/kibot-commit-check.yaml

This file was deleted.

47 changes: 0 additions & 47 deletions .github/workflows/kibot-release-from-tag.yaml

This file was deleted.

Binary file removed Firmware/LowLevel/bin/firmware.elf
Binary file not shown.
Binary file removed Firmware/LowLevel/bin/firmware.uf2
Binary file not shown.
72 changes: 72 additions & 0 deletions Firmware/LowLevel/include/soundsystem.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
// Created by Elmar Elflein on 18/07/22.
// Copyright (c) 2022 Elmar Elflein. All rights reserved.
//
// This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
//
// Feel free to use the design in your private/educational projects, but don't try to sell the design or products based on it without getting my consent first.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
//
#ifndef _SOUND_SYSTEM_H_
#define _SOUND_SYSTEM_H_

//#include <Arduino.h>
#include <stdint.h>
#include <list>

#include <pins.h>
#include <DFPlayerMini_Fast.h>
#include <soundsystem.h>


#define BUFFERSIZE 100

#define NR_SOUNDFILES 15 // Number of Soundfiles on SD-card



class MP3Sound
{




public:

uint32_t anzSoundfiles; // number of files stored on the SD-card
bool playing;

MP3Sound();

bool begin(int anzsoundsOnSD); // init serial stream and soundmodule, anzsoundOnSD : maximum number of available soundfiles on the SD-card

void playSound(int soundNr); // play soundfile number. This method writes soundfile nr in a list, the method processSounds() (has to run in loop) will play
// the sounds according to the list

void playSoundAdHoc(int soundNr); // play soundfile number immediately whithout waiting until the end of sound

void setvolume(int vol); // scales loudness from 0 to 100 %

int sounds2play(); // returns the number if sounds to play in the list

int processSounds(); // play all sounds from the list. This method has to be calles cyclic, e.g. every second.


private:
std::list <int> active_sounds;
bool sound_available;




};


#endif // _SOUND_SYSTEM_H_ HEADER_FILE
110 changes: 110 additions & 0 deletions Firmware/LowLevel/lib/JY901/JY901.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
#include "JY901.h"
#include "string.h"

CJY901 ::CJY901(HardwareSerial *serial)
{
this->serial = serial;
}

void CJY901::begin(int baudrate) {
serial->begin(baudrate);
delay(1000);
uint8_t unlock[] = {0xFF,0xF0,0xF0,0xF0,0xF0};
serial->write(unlock, 5);
serial->flush();
delay(10);
writeRegister(RSW, 0b0000000000010110);
delay(10);
writeRegister(RRATE, 0x09);
delay(10);
writeRegister(0x0b,0x00);
delay(10);
writeRegister(0x0c,0x00);
delay(10);
writeRegister(0x0d,0x00);
delay(10);




ucRxCnt = 0;
}

void CJY901 ::update()
{
while (serial->available())
{

ucRxBuffer[ucRxCnt++] = serial->read();
if (ucRxBuffer[0] != 0x55)
{
ucRxCnt = 0;
continue;
}
if (ucRxCnt < 11)
{
continue;
}
else
{
switch (ucRxBuffer[1])
{
case 0x50:
memcpy(&stcTime, &ucRxBuffer[2], 8);
break;
case 0x51:
memcpy(&stcAcc, &ucRxBuffer[2], 8);
break;
case 0x52:
memcpy(&stcGyro, &ucRxBuffer[2], 8);
break;
case 0x53:
memcpy(&stcAngle, &ucRxBuffer[2], 8);
break;
case 0x54:
memcpy(&stcMag, &ucRxBuffer[2], 8);
break;
case 0x55:
memcpy(&stcDStatus, &ucRxBuffer[2], 8);
break;
case 0x56:
memcpy(&stcPress, &ucRxBuffer[2], 8);
break;
case 0x57:
memcpy(&stcLonLat, &ucRxBuffer[2], 8);
break;
case 0x58:
memcpy(&stcGPSV, &ucRxBuffer[2], 8);
break;
}
ucRxCnt = 0;
}
}
}

void CJY901::writeRegister(uint8_t address, uint16_t data) {
uint8_t unlock[] = {0xFF,0xAA,0x69,0x88,0xB5};
serial->write(unlock, 5);
serial->flush();
delay(100);

uint8_t buffer[6];
buffer[0] = 0xFF;
buffer[1] = 0xAA;
buffer[2] = address;
buffer[3] = data & 0xFF;
buffer[4] = (data >> 8) & 0xFF;

serial->write(buffer, 5);
serial->flush();

serial->write(unlock, 5);
serial->flush();
delay(100);

uint8_t save[] = {0xFF,0xAA,0x00,0x00,0x00};
serial->write(save, 5);
serial->flush();
delay(100);

}
Loading

0 comments on commit 3378c06

Please sign in to comment.