Skip to content
Merged

RSSI #13

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
19 changes: 14 additions & 5 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
name: Deploy Garage on Environment

on:
deployment:
workflow_dispatch:
inputs:
environment:
required: true
type: choice
options:
- Home
serial_port:
required: true
type: string

permissions:
contents: read
Expand All @@ -10,7 +19,7 @@ permissions:
jobs:
deployment:
runs-on: [self-hosted, iot]
environment: Home
environment: ${{ inputs.environment }}

steps:

Expand Down Expand Up @@ -69,14 +78,14 @@ jobs:

- name: Compile Arduino project
run: |
& "$Env:RUNNER_TOOL_CACHE\arduino-cli\arduino-cli.exe" --config-file "$Env:RUNNER_TOOL_CACHE\arduino-cli\config.yaml" compile --profile Garage_UNO ./ --output-dir build
& "$Env:RUNNER_TOOL_CACHE\arduino-cli\arduino-cli.exe" --config-file "$Env:RUNNER_TOOL_CACHE\arduino-cli\config.yaml" compile ./ --output-dir build

- name: Upload firmware to Arduino
env:
SERIAL_PORT: ${{ github.event.deployment.payload.serial_port }}
SERIAL_PORT: ${{ github.event.inputs.serial_port }}
run: |
if ($env:SERIAL_PORT -notmatch '^COM\d+$') {
Write-Error "Invalid serial port format: $env:SERIAL_PORT"
exit 1
}
& "$Env:RUNNER_TOOL_CACHE\arduino-cli\arduino-cli.exe" --config-file "$Env:RUNNER_TOOL_CACHE\arduino-cli\config.yaml" upload --profile Garage_UNO --port $env:SERIAL_PORT --input-dir build
& "$Env:RUNNER_TOOL_CACHE\arduino-cli\arduino-cli.exe" --config-file "$Env:RUNNER_TOOL_CACHE\arduino-cli\config.yaml" upload --port $env:SERIAL_PORT --input-dir build
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[submodule "MQTTESP8266"]
path = MQTTESP8266
url = https://github.com/Zefek/MQTTESP8266.git
branch = 6.0
branch = RSSI
4 changes: 3 additions & 1 deletion Garage.ino
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ struct DiagData {
uint8_t resetReason;
uint16_t loopMaxMs;
uint16_t doorCycles;
int8_t rssi;
};
#pragma pack(pop)

Expand All @@ -46,7 +47,7 @@ AM2302::AM2302_Sensor am2302{ TEMPERATURE_SENSOR_PIN };
char temperatureData[10];
bool doorMoveDetected = false;
bool closeRequired = false;
DiagData currentDiagData = { 0, 0, 0, 0, 0, 0, 0, 0 };
DiagData currentDiagData = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
unsigned long lastDiagSendMillis = 0;

extern int __heap_start, *__brkval;
Expand Down Expand Up @@ -150,6 +151,7 @@ void sendDiag()
{
currentDiagData.uptime = currentMillis / 60000;
currentDiagData.freeRam = freeRam();
currentDiagData.rssi = espDrv.GetRssi();
uint8_t buffer[sizeof(DiagData)];
memcpy(buffer, &currentDiagData, sizeof(DiagData));
mqttClient.Publish(GARAGE_DIAG, buffer, sizeof(DiagData), false);
Expand Down
Loading