Skip to content

Commit

Permalink
Add platform io sim (#31)
Browse files Browse the repository at this point in the history
* Lower default SPI Clock

Lowered the default SPI clock as some displays might show glitches with the SPI frequency set above 40MHz.

* Added missing library components

Added the missing library symbols, footprints and 3D-models. These are all in a project-specific library called "omoteLib" (#19)

* Implement MQTT publish in HardwareRevX

Change-Id: I7b6955a662716f83dd8daf34128a353efa26bf80

* add batteryStatus info and allow access to it through the interface.

Change-Id: Ieb748b1478d532f52ffff9edc783de3cbcf9f303

* rename hardwareAbstractionInterface

Change-Id: I39a9bcd7fc4d92b271a40a869faae7870d6d88a1

* rename HardwareAbstractionInterface files

Change-Id: Ifb6a96c38da61cb80aabc6c929e392a2fc91cf29

* fixed a typo

* Re work directory structure to support new architecture

Still need to get the Sim building

* lvgl simulator working.

* put init code into HardwareSimulator Class

* ensure all targets build
remove unused assets.c
add new github actions that reflect new simulator

* clean up build defines by using platform.ini to override default lv_config.
remove unneeded include directory.

Change-Id: Id63baa80dae89977d239a539b5db9ff67266e1d6

* Fix ESP32 Windows build after battling escape characters.
Add esp32 Windows target to Actions.

* Fixed screen height

- corrected the SCREEN_HEIGHT
- small graphical changes in OmoteUI to make it look like in the main branch

---------

Co-authored-by: Max <[email protected]>
Co-authored-by: Matthew Colvin <[email protected]>
Co-authored-by: Matthew Colvin <[email protected]>
  • Loading branch information
4 people authored Aug 11, 2023
1 parent f1ff9ed commit 7a9ee13
Show file tree
Hide file tree
Showing 45 changed files with 65,184 additions and 1,946 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/build-platformio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ on: [push]

jobs:
build:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ windows-latest, ubuntu-latest ]

steps:
- uses: actions/checkout@v3
Expand All @@ -22,4 +25,4 @@ jobs:

- name: Build PlatformIO Project
working-directory: ./Platformio
run: pio run
run: pio run --environment esp32
29 changes: 29 additions & 0 deletions .github/workflows/build-simulator-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Windows Simulator Build

on: [push]

jobs:
build-windows:
runs-on: windows-latest

steps:
- uses: msys2/setup-msys2@v2
with:
update: true
install: >-
mingw-w64-x86_64-gcc
mingw-w64-x86_64-SDL2
mingw-w64-x86_64-python
python3-pip
- uses: actions/checkout@v3

- name: Install Platform IOCore
run: pip install --upgrade platformio

- name: Put MSYS2_MinGW64 on PATH
# there is not yet an environment variable for this path from msys2/setup-msys2
run: echo "${{ runner.temp }}/msys64/mingw64/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append

- name: Build PlatformIO Project 64 bit sim
working-directory: ./Platformio
run: pio run --environment x64_sim
45 changes: 18 additions & 27 deletions .github/workflows/build-simulator.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,28 @@
name: Simulator Build
name: Ubuntu Simulator Build

on: [push]

jobs:
build-x64:

runs-on: windows-latest
build-ubuntu:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Add msbuild to PATH
uses: microsoft/[email protected]
- uses: actions/cache@v3
with:
msbuild-architecture: x64

# You can test your matrix by printing the current dotnet version
- name: Build
working-directory: ./LVGL Simulator
run: MSBuild.exe ./LVGL.Simulator.sln -target:Build /p:Platform="x64"

build-x86:

runs-on: windows-latest

steps:
- uses: actions/checkout@v3

- name: Add msbuild to PATH
uses: microsoft/[email protected]
path: |
~/.cache/pip
~/.platformio/.cache
key: ${{ runner.os }}-pio
- uses: actions/setup-python@v4
with:
msbuild-architecture: x86
python-version: "3.9"
- name: Install PlatformIO Core
run: pip install --upgrade platformio

- name: Install SDL2
run : sudo apt-get update && sudo apt-get install -y libsdl2-dev

- name: Build
working-directory: ./LVGL Simulator
run: MSBuild.exe ./LVGL.Simulator.sln -target:Build /p:Platform="x86"
- name: Build PlatformIO Project 64 bit sim
working-directory: ./Platformio
run: pio run --environment x64_sim
39 changes: 19 additions & 20 deletions LVGL Simulator/LVGL.Simulator/HardwareSimulator.hpp
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
#pragma once
#include "HardwareAbstractionInterface.h"
#include <string>
#include "HardwareInterface.h"
#include <iostream>
#include <string>

class HardwareSimulator :
public HardwareAbstractionInterface
{
public:

HardwareSimulator() = default;
class HardwareSimulator : public HardwareInterface {
public:
HardwareSimulator() = default;

virtual void debugPrint(std::string message) override {
std::cout << message;
}
virtual void debugPrint(std::string message) override {
std::cout << message;
}

virtual void sendIR() override {

}
virtual void sendIR() override {}

virtual void MQTTPublish(const char* topic, const char* payload) override {
virtual void MQTTPublish(const char *topic, const char *payload) override{

};
};

virtual void init() override {
lv_init();
}
virtual void init() override { lv_init(); }

virtual batteryStatus getBatteryPercentage() {
batteryStatus fakeStatus;
fakeStatus.isCharging = false;
fakeStatus.percentage = 100;
fakeStatus.voltage = 4200;
return fakeStatus;
}
};

3 changes: 1 addition & 2 deletions LVGL Simulator/LVGL.Simulator/LVGL.Simulator.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<Import Project="LVGL.Portable.vcxitems" />
<Import Project="LVGL.Drivers.vcxitems" />
<ItemGroup>
<ClInclude Include="..\..\Platformio\include\OmoteUI\HardwareAbstractionInterface.h" />
<ClInclude Include="..\..\Platformio\include\OmoteUI\HardwareInterface.h" />
<ClInclude Include="..\..\Platformio\include\OmoteUI\Images.hpp" />
<ClInclude Include="..\..\Platformio\include\OmoteUI\OmoteUI.hpp" />
<ClInclude Include="HardwareSimulator.hpp" />
Expand All @@ -62,7 +62,6 @@
<ClInclude Include="resource.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\Platformio\src\HardwareAbstractionInterface.cpp" />
<ClCompile Include="..\..\Platformio\src\OmoteUI.cpp" />
<ClCompile Include="HardwareSimulator.cpp" />
<ClCompile Include="LVGL.Simulator.cpp">
Expand Down
9 changes: 3 additions & 6 deletions LVGL Simulator/LVGL.Simulator/LVGL.Simulator.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
<ClInclude Include="lv_conf.h" />
<ClInclude Include="lv_drv_conf.h" />
<ClInclude Include="HardwareSimulator.hpp" />
<ClInclude Include="..\..\Platformio\include\OmoteUI\HardwareAbstractionInterface.h">
<Filter>OmoteUI</Filter>
</ClInclude>
<ClInclude Include="..\..\Platformio\include\OmoteUI\OmoteUI.hpp">
<Filter>OmoteUI</Filter>
</ClInclude>
<ClInclude Include="omoteconfig.h" />
<ClInclude Include="..\..\Platformio\include\OmoteUI\Images.hpp">
<Filter>OmoteUI</Filter>
</ClInclude>
<ClInclude Include="..\..\Platformio\include\OmoteUI\HardwareInterface.h">
<Filter>OmoteUI</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Manifest Include="LVGL.Simulator.manifest" />
Expand All @@ -27,9 +27,6 @@
<ItemGroup>
<ClCompile Include="LVGL.Simulator.cpp" />
<ClCompile Include="HardwareSimulator.cpp" />
<ClCompile Include="..\..\Platformio\src\HardwareAbstractionInterface.cpp">
<Filter>OmoteUI</Filter>
</ClCompile>
<ClCompile Include="..\..\Platformio\src\OmoteUI.cpp">
<Filter>OmoteUI</Filter>
</ClCompile>
Expand Down
30 changes: 15 additions & 15 deletions PCB/Remote.kicad_pcb
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@
(stroke (width 0) (type solid)) (fill solid) (layer "F.SilkS") (tstamp 51db3da6-9e43-47ce-9571-e63cf05ae317))
)

(footprint "mkern:LED_5mm_Side_Mount" locked (layer "F.Cu")
(footprint "omoteLib:LED_5mm_Side_Mount" locked (layer "F.Cu")
(tstamp 028982f1-ec49-4f15-a3a1-367832d00d71)
(at 59.676677 102 90)
(descr "5mm LED for horizontal soldering to the board edge")
Expand Down Expand Up @@ -466,7 +466,7 @@
(net 48 "GND") (pinfunction "K") (pintype "passive") (tstamp 71289672-541a-40f3-bb92-b36055f6b1d6))
(pad "2" smd rect locked (at -1.275 3.5 90) (size 1.5 5) (layers "F.Cu" "F.Paste" "F.Mask")
(net 14 "Net-(D2-A)") (pinfunction "A") (pintype "passive") (tstamp ffb8b095-3661-40af-83bd-a02a8d8ca89c))
(model "${KICAD_USER_3DMODEL_DIR}/Side Mount LED v1.step"
(model "${KIPRJMOD}/project_libraries/3D-models/Side Mount LED v1.step"
(offset (xyz 0 0 0.25))
(scale (xyz 1 1 1))
(rotate (xyz 90 0 0))
Expand Down Expand Up @@ -648,7 +648,7 @@
)
)

(footprint "mkern:JST_PH_B2B-PH-SM4-TB_1x02-1MP_P2.00mm_Vertical" (layer "F.Cu")
(footprint "omoteLib:JST_PH_B2B-PH-SM4-TB_1x02-1MP_P2.00mm_Vertical" (layer "F.Cu")
(tstamp 06c0ec99-fe4f-4c5e-9492-8f7abb1bea3e)
(at 224.9 113.5 90)
(descr "JST PH series connector, B2B-PH-SM4-TB (http://www.jst-mfg.com/product/pdf/eng/ePH.pdf), generated with kicad-footprint-generator")
Expand Down Expand Up @@ -729,7 +729,7 @@
(net 48 "GND") (pinfunction "Pin_2") (pintype "passive") (tstamp a8674511-9189-4417-9af0-7e68e5f383e2))
(pad "MP" smd roundrect (at -3.4 -1.75 90) (size 1.6 3) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.15625) (tstamp 7ec99062-2840-4ac6-8a0d-545eb56296d1))
(pad "MP" smd roundrect (at 3.4 -1.75 90) (size 1.6 3) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.15625) (tstamp 2c9323e8-8263-4b88-b05b-7ff99f5bc2b5))
(model "${KICAD_USER_3DMODEL_DIR}/B2B-PH-SM4-TB.STEP"
(model "${KIPRJMOD}/project_libraries/3D-models/B2B-PH-SM4-TB.STEP"
(offset (xyz -4 3.25 0))
(scale (xyz 1 1 1))
(rotate (xyz -90 0 0))
Expand Down Expand Up @@ -1370,7 +1370,7 @@
)
)

(footprint "mkern:QFN-48-1EP_7x7mm_P0.5mm_EP5.3x5.3mm_ThermalVias_MR" (layer "F.Cu")
(footprint "omoteLib:QFN-48-1EP_7x7mm_P0.5mm_EP5.3x5.3mm_ThermalVias_MR" (layer "F.Cu")
(tstamp 21878e1b-21e2-436e-9384-827df816db75)
(at 76.85 91.55)
(descr "QFN, 48 Pin (https://www.trinamic.com/fileadmin/assets/Products/ICs_Documents/TMC2041_datasheet.pdf#page=62), generated with kicad-footprint-generator ipc_noLead_generator.py")
Expand Down Expand Up @@ -1615,7 +1615,7 @@
)
)

(footprint "mkern:XDCR_LIS3DHTR" (layer "F.Cu")
(footprint "omoteLib:XDCR_LIS3DHTR" (layer "F.Cu")
(tstamp 230440db-a366-4510-924d-f45962ca2d45)
(at 89.75 84.786992 90)
(property "MANUFACTURER" "STMicroelectronics")
Expand Down Expand Up @@ -1694,7 +1694,7 @@
(net 97 "unconnected-(U5-ADC2-Pad15)") (pinfunction "ADC2") (pintype "input+no_connect") (solder_paste_margin_ratio -0.05) (tstamp 0d3a3e5a-4358-4958-b320-6834c31fe10c))
(pad "16" smd rect (at -0.5 -1.3 180) (size 0.8 0.3) (layers "F.Cu" "F.Paste" "F.Mask")
(net 98 "unconnected-(U5-ADC1-Pad16)") (pinfunction "ADC1") (pintype "input+no_connect") (solder_paste_margin_ratio -0.05) (tstamp 9aa4f2f5-5d32-456f-89d1-63571efbe5d2))
(model "${KICAD_USER_3DMODEL_DIR}/LIS3DHTR.step"
(model "${KIPRJMOD}/project_libraries/3D-models/LIS3DHTR.step"
(offset (xyz 0 0 0))
(scale (xyz 1 1 1))
(rotate (xyz -90 0 0))
Expand Down Expand Up @@ -4052,7 +4052,7 @@
(stroke (width 0) (type solid)) (fill solid) (layer "F.Mask") (tstamp 299dc0c1-5c29-4cd1-b7d9-0cce8367cfa3))
)

(footprint "mkern:TFT_2.83IN_240X320_50PIN" locked (layer "F.Cu")
(footprint "omoteLib:TFT_2.83IN_240X320_50PIN" locked (layer "F.Cu")
(tstamp 5a621486-0b9c-4ec0-862b-29bd1b417bb9)
(at 91.622852 102 90)
(property "Sheetfile" "Remote.kicad_sch")
Expand Down Expand Up @@ -4766,12 +4766,12 @@
(net 48 "GND") (pinfunction "MP") (pintype "passive") (solder_mask_margin 0.1016) (tstamp 4eb426d9-e540-47c5-9b76-3e1d32abc52e))
(pad "MP" smd roundrect locked (at 14.35 13.09 270) (size 2.4 2.4) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.125)
(net 48 "GND") (pinfunction "MP") (pintype "passive") (solder_mask_margin 0.1016) (tstamp 2e81d339-fff0-4f74-96c2-d969d63a15e6))
(model "${KICAD_USER_3DMODEL_DIR}/541325062_colored.step"
(model "${KIPRJMOD}/project_libraries/3D-models/541325062_colored.step"
(offset (xyz 0 -15.5 0))
(scale (xyz 1 1 1))
(rotate (xyz 0 0 0))
)
(model "${KICAD_USER_3DMODEL_DIR}/280QV10 v5.step"
(model "${KIPRJMOD}/project_libraries/3D-models/280QV10 v5.step"
(offset (xyz 0 -22.25 -6))
(scale (xyz 1 1 1))
(rotate (xyz 180 0 180))
Expand Down Expand Up @@ -4932,7 +4932,7 @@
)
)

(footprint "mkern:Heimdall vertical" (layer "F.Cu")
(footprint "omoteLib:Heimdall vertical" (layer "F.Cu")
(tstamp 5d2b74c8-ea79-4f25-99fd-c78691bddaa1)
(at 55.4 116.3 90)
(descr "VISHAY Heimdall for TSSP77038")
Expand Down Expand Up @@ -4989,7 +4989,7 @@
(net 87 "IR_VCC") (pinfunction "Vs") (pintype "power_in") (tstamp 122ac044-9956-47ad-90b3-cd90dd9d6e84))
(pad "4" smd rect (at 1.9 0.7 180) (size 2 0.8) (layers "F.Cu" "F.Paste" "F.Mask")
(net 48 "GND") (pinfunction "GND") (pintype "power_in") (tstamp a399ed69-ca57-4198-ac99-c2971749e3d2))
(model "${KICAD_USER_3DMODEL_DIR}/82672Heimdall.stp"
(model "${KIPRJMOD}/project_libraries/3D-models/82672Heimdall.stp"
(offset (xyz 0 -1.2 1.6))
(scale (xyz 1 1 1))
(rotate (xyz -90 0 -180))
Expand Down Expand Up @@ -8289,7 +8289,7 @@
)
)

(footprint "mkern:RFANT5220110A2T" (layer "F.Cu")
(footprint "omoteLib:RFANT5220110A2T" (layer "F.Cu")
(tstamp cdd38a2c-3189-4b09-aa8d-b7b99e8e71b9)
(at 55.500146 85.711992)
(descr "Walsin RFANT5220110A2T SMD antenna 2400-2500Mhz, 2dBi, http://www.passivecomponent.com/wp-content/uploads/2013/12/ASC_RFANT5220110A2T_V03.pdf")
Expand Down Expand Up @@ -8339,7 +8339,7 @@
(pad "" smd roundrect (at -2.7 0) (size 1 2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.208333) (tstamp cc86c1ac-e652-4e6f-8b3b-2ad7dcf806b0))
(pad "1" smd roundrect (at 2.7 0 180) (size 1 2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.208333)
(net 3 "Net-(AE1-A)") (pinfunction "A") (pintype "input") (tstamp 5f31508e-8dcd-4d96-b5f5-cf3f4a95c613))
(model "${KICAD_USER_3DMODEL_DIR}/Walsin RFANT5220110A2T v1.step"
(model "${KIPRJMOD}/project_libraries/3D-models/Walsin RFANT5220110A2T v1.step"
(offset (xyz 0 0 0))
(scale (xyz 1 1 1))
(rotate (xyz -90 0 -90))
Expand Down Expand Up @@ -8955,7 +8955,7 @@
)
)

(footprint "mkern:USB_C_Receptacle_HRO_TYPE-C-31-M-12" (layer "F.Cu")
(footprint "omoteLib:USB_C_Receptacle_HRO_TYPE-C-31-M-12" (layer "F.Cu")
(tstamp ed154c17-7f27-4787-a05a-0859bc96f71a)
(at 241 102 90)
(descr "USB Type-C receptacle for USB 2.0 and PD, http://www.krhro.com/uploads/soft/180320/1-1P320120243.pdf")
Expand Down
4 changes: 2 additions & 2 deletions PCB/Remote.kicad_pro
Original file line number Diff line number Diff line change
Expand Up @@ -486,10 +486,10 @@
},
"libraries": {
"pinned_footprint_libs": [
"mkern"
"omoteLib"
],
"pinned_symbol_libs": [
"mkern"
"omoteLib"
]
},
"meta": {
Expand Down
Loading

0 comments on commit 7a9ee13

Please sign in to comment.