From 1c6bbc2c0682a85adb18134a6d8f176a656eb7d5 Mon Sep 17 00:00:00 2001 From: "Ben V. Brown" Date: Sun, 20 Nov 2022 21:28:15 +1100 Subject: [PATCH] Hook up power source enum --- source/Core/BSP/Pinecilv2/ble_handlers.cpp | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/source/Core/BSP/Pinecilv2/ble_handlers.cpp b/source/Core/BSP/Pinecilv2/ble_handlers.cpp index 5884a266..ecd0cb45 100644 --- a/source/Core/BSP/Pinecilv2/ble_handlers.cpp +++ b/source/Core/BSP/Pinecilv2/ble_handlers.cpp @@ -8,28 +8,30 @@ #include "types.h" +#include "BSP.h" +#include "TipThermoModel.h" #include "ble_peripheral.h" #include "bluetooth.h" +#include "configuration.h" #include "conn.h" #include "gatt.h" #include "hal_clock.h" #include "hci_core.h" #include "log.h" #include "uuid.h" -#include "configuration.h" -#include "BSP.h" -#include "TipThermoModel.h" +#include "USBPD.h" #include "ble_characteristics.h" #include "ble_handlers.h" +#include "pd.h" #include "power.hpp" - int ble_char_read_status_callback(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, u16_t len, u16_t offset) { +int ble_char_read_status_callback(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, u16_t len, u16_t offset) { if (attr == NULL || attr->uuid == NULL) { return 0; } uint16_t uuid_value = ((struct bt_uuid_16 *)attr->uuid)->val; - uint32_t temp=0; + uint32_t temp = 0; switch (uuid_value) { case 1: // Live temp { @@ -37,7 +39,7 @@ memcpy(buf, &temp, sizeof(temp)); return sizeof(temp); } break; - case 2://Setpoint temp + case 2: // Setpoint temp temp = getSettingValue(SettingsOptions::SolderingTemp); memcpy(buf, &temp, sizeof(temp)); return sizeof(temp); @@ -57,21 +59,15 @@ temp = X10WattsToPWM(x10WattHistory.average()); memcpy(buf, &temp, sizeof(temp)); return sizeof(temp); - break; case 6: // power src - // Todo return enum for current power source + // Todo return enum for current power source break; } MSG("Unhandled attr read %d | %d\n", (uint32_t)attr->uuid, uuid_value); return 0; } -/************************************************************************* -NAME - ble_tp_recv_wr(receive data from client) -*/ - int ble_tp_recv_wr(struct bt_conn *conn, const struct bt_gatt_attr *attr, const void *buf, u16_t len, u16_t offset, u8_t flags) { BT_WARN("recv data len=%d, offset=%d, flag=%d\n", len, offset, flags); BT_WARN("recv data:%s\n", bt_hex(buf, len));