forked from stuartpittaway/diyBMSv4Code
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/master'
- Loading branch information
Showing
54 changed files
with
6,632 additions
and
3,719 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
name: PlatformIO CI | ||
|
||
on: | ||
push: | ||
|
||
jobs: | ||
job_build_modulecode: | ||
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: Build code for modules | ||
run: pio run --project-dir=./ATTINYCellModule --project-conf=./ATTINYCellModule/platformio.ini | ||
|
||
- name: Publish Artifacts 1 | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: DIYBMS-Compiled-Module | ||
path: | | ||
./ATTINYCellModule/.pio/build/V*/*.hex | ||
./ATTINYCellModule/.pio/build/V*/*.elf | ||
if-no-files-found: error | ||
|
||
|
||
job_build_controller_esp8266: | ||
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: Build code for controller | ||
run: pio run --project-dir=./ESPController --environment esp8266_d1mini --project-conf=./ESPController/platformio.ini | ||
|
||
- name: Publish Artifacts 2 | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: DIYBMS-Compiled-Controller-ESP8266 | ||
path: ./ESPController/.pio/build/*/*.bin | ||
if-no-files-found: error | ||
|
||
- name: Build File System Image for ESP8266 | ||
run: pio run --project-dir=./ESPController --target buildfs --environment esp8266_d1mini | ||
|
||
- name: Publish Artifacts 3 | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: DIYBMS-Compiled-Controller-ESP8266 | ||
path: ./ESPController/.pio/build/*/*.bin | ||
if-no-files-found: error | ||
|
||
job_zip_code: | ||
runs-on: ubuntu-latest | ||
needs: [job_build_modulecode, job_build_controller_esp8266] | ||
steps: | ||
- name: Download artifact DIYBMS-Compiled-Controller-ESP8266 | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: DIYBMS-Compiled-Controller-ESP8266 | ||
|
||
- name: Download artifact DIYBMS-Compiled-Module | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: DIYBMS-Compiled-Module | ||
|
||
- name: Display structure of downloaded files | ||
run: ls -R | ||
|
||
- name: ZIP output for release | ||
run: | | ||
zip --junk-paths release.zip ./esp8266_d1mini/diybms_controller_firmware_espressif8266_esp8266_d1mini.bin | ||
zip --junk-paths release.zip ./esp8266_d1mini/diybms_controller_filesystemimage_espressif8266_esp8266_d1mini.bin | ||
zip --junk-paths release.zip ./V*/*.hex | ||
- name: Get current date | ||
id: date | ||
run: echo "dt=$(date +'%Y-%m-%d-%H-%M')" >> $GITHUB_ENV | ||
|
||
- name: Display structure of downloaded files | ||
run: mv release.zip release_${{ env.dt }}.zip | ||
|
||
- name: Create Release Files on MASTER branch only | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
if: github.ref == 'refs/heads/master' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token | ||
with: | ||
tag_name: Tag-${{ env.dt }} | ||
release_name: Release-${{ env.dt }} | ||
body: | | ||
Automatically generated release | ||
draft: false | ||
prerelease: false | ||
|
||
- name: Upload Release Asset | ||
id: upload-release-asset | ||
uses: actions/upload-release-asset@v1 | ||
if: github.ref == 'refs/heads/master' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./release_${{ env.dt }}.zip | ||
asset_name: Compiled_Firmware_${{ env.dt }}.zip | ||
asset_content_type: application/zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ | |
.piolibdeps | ||
.clang_complete | ||
.gcc-flags.json | ||
.pio | ||
.pio | ||
EmbeddedFiles_Defines.h |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
Import("env") | ||
|
||
platform = env.PioPlatform() | ||
|
||
#print(env) | ||
#print(platform) | ||
|
||
my_flags = env.ParseFlags(env['BUILD_FLAGS']) | ||
#print(my_flags) | ||
defines = {k: v for (k, v) in my_flags.get("CPPDEFINES")} | ||
print(defines.get("DIYBMSMODULEVERSION")) | ||
|
||
efuse=hex(int(env.GetProjectOption("board_fuses.efuse"), 2)).upper()[2:4] | ||
hfuse=hex(int(env.GetProjectOption("board_fuses.hfuse"), 2)).upper()[2:4] | ||
lfuse=hex(int(env.GetProjectOption("board_fuses.lfuse"), 2)).upper()[2:4] | ||
|
||
env.Replace(PROGNAME="module_fw_%s_%s_%s%s_e%s_h%s_l%s" % (env["PIOENV"],env.get("BOARD"), defines.get("DIYBMSMODULEVERSION"), "_SWAPR19R20" if "SWAPR19R20" in defines else "", efuse, hfuse, lfuse )) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
""" Script for DIYBMS """ | ||
import datetime | ||
import subprocess | ||
import os | ||
from os import path | ||
|
||
Import("env") | ||
|
||
env.Replace(PROGNAME="diybms_controller_firmware_%s_%s" % | ||
(env["PIOPLATFORM"], env["PIOENV"])) | ||
|
||
git_sha=None | ||
|
||
AreWeInGitHubAction = True if "GITHUB_SHA" in env else False | ||
|
||
if (AreWeInGitHubAction): | ||
git_sha=env["GITHUB_SHA"] | ||
else: | ||
if (path.exists('..'+os.path.sep+'.git')): | ||
# Get the latest GIT version header/name | ||
try: | ||
git_sha = subprocess.check_output(['git','log','-1','--pretty=format:%H']).decode('utf-8') | ||
except: | ||
# Ignore any error, user may not have GIT installed | ||
git_sha = None | ||
|
||
# print(env.Dump()) | ||
|
||
include_dir = os.path.join(env.get('PROJECT_DIR'), 'include') | ||
|
||
if (os.path.exists(include_dir) == False): | ||
raise Exception("Missing include folder") | ||
|
||
|
||
with open(os.path.join(include_dir, 'EmbeddedFiles_Defines.h'), 'w') as f: | ||
f.write("// This is an automatically generated file, any changes will be overwritten on compiliation!\n") | ||
f.write("// DO NOT CHECK THIS INTO SOURCE CONTROL\n") | ||
f.write("\n\n#ifndef EmbeddedFiles_Defines_H\n#define EmbeddedFiles_Defines_H\n\n") | ||
|
||
f.write("static const char GIT_VERSION[] = \"") | ||
if (git_sha!=None): | ||
f.write(git_sha) | ||
else: | ||
f.write("LocalCompile") | ||
f.write("\";\n\n") | ||
|
||
f.write("static const uint16_t GIT_VERSION_B1 = 0x") | ||
if (git_sha!=None): | ||
f.write(git_sha[32:36]) | ||
else: | ||
#Default for local compile | ||
f.write("FFFF") | ||
f.write(";\n\n") | ||
|
||
f.write("static const uint16_t GIT_VERSION_B2 = 0x") | ||
if (git_sha!=None): | ||
f.write(git_sha[36:]) | ||
else: | ||
#Default for local compile | ||
f.write("FFFF") | ||
f.write(";\n\n") | ||
|
||
|
||
f.write("static const char COMPILE_DATE_TIME[] = \"") | ||
f.write(datetime.datetime.utcnow().isoformat()[:-3]+'Z') | ||
f.write("\";\n\n") | ||
|
||
f.write("#endif") |
Oops, something went wrong.