mirror of
https://github.com/meshtastic/firmware.git
synced 2025-08-19 19:53:18 +00:00
Report battery level to other nodes in mesh (and apps).
Also today I'll turn back on the the standard "has a battery" BLE
device profile, so the locally connected radio should show up in the
phone's bluetooth popup of battery levels (similar to how a BLE
headphone battery level appears)
cc @lgoix - using code from @professr
```
meshtastic --info
Connected to radio...
my_node_num: 2883444536
has_gps: true
num_channels: 13
region: "unset"
hw_model: "tbeam"
firmware_version: "unset"
packet_id_bits: 32
current_packet_id: 91018534
node_num_bits: 32
message_timeout_msec: 300000
min_app_version: 172
preferences {
position_broadcast_secs: 900
send_owner_interval: 4
wait_bluetooth_secs: 120
screen_on_secs: 300
phone_timeout_secs: 900
phone_sds_timeout_sec: 7200
mesh_sds_timeout_secs: 7200
sds_secs: 31536000
ls_secs: 3600
}
channel_settings {
tx_power: 23
modem_config: Bw125Cr48Sf4096
psk: "\324\361\273: )\007Y\360\274\377\253\317Ni\277"
name: "Default"
}
Nodes in mesh:
{'num': 2883444536, 'user': {'id': '!2462abdddf38', 'longName': 'Unknown df38', 'shortName': '?38', 'macaddr': 'JGKr3d84'}, 'position': {'altitude': 96, 'batteryLevel': 100, 'latitudeI': 375210641, 'longitudeI': -1223090398, 'time': 1592843564, 'latitude': 37.5210641, 'longitude': -122.3090398}}
```
This commit is contained in:
parent
0c0b2446b7
commit
c5851a4a0c
@ -2,6 +2,7 @@
|
||||
|
||||
You probably don't care about this section - skip to the next one.
|
||||
|
||||
- report battery level to android app
|
||||
- @feh123 Sony Xperia Z1 C6903 running Android 5.1.1
|
||||
- don't stop advertising BLE
|
||||
- first message sent is still doubled for some people
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
#include "PowerFSM.h"
|
||||
#include "main.h"
|
||||
#include "mesh-pb-constants.h"
|
||||
#include "power.h"
|
||||
|
||||
/*
|
||||
receivedPacketQueue - this is a queue of messages we've received from the mesh, which we are keeping to deliver to the phone.
|
||||
@ -298,6 +299,9 @@ int MeshService::onGPSChanged(void *unused)
|
||||
pos.time = getValidTime();
|
||||
}
|
||||
|
||||
// Include our current battery voltage in our position announcement
|
||||
pos.battery_level = powerStatus.batteryChargePercent;
|
||||
|
||||
// We limit our GPS broadcasts to a max rate
|
||||
static uint32_t lastGpsSend;
|
||||
uint32_t now = millis();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user