Hook up power source enum

This commit is contained in:
Ben V. Brown
2022-11-20 21:28:15 +11:00
parent d0ed30ecb6
commit 1c6bbc2c06

View File

@@ -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,7 +59,6 @@
temp = X10WattsToPWM(x10WattHistory.average());
memcpy(buf, &temp, sizeof(temp));
return sizeof(temp);
break;
case 6: // power src
// Todo return enum for current power source
@@ -67,11 +68,6 @@
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));