Fix most of the warnings. Remaining warnings come from nimble source code.

This commit is contained in:
JF
2020-08-17 16:31:00 +02:00
parent 18686ac2cb
commit 83f6d7d81b
27 changed files with 59 additions and 224 deletions

View File

@@ -116,7 +116,7 @@ void AlertNotificationClient::OnNotification(ble_gap_event *event) {
char *s = (char *) &data[3];
auto messageSize = min(maxMessageSize, (bufferSize-3));
for (int i = 0; i < messageSize-1; i++) {
for (uint i = 0; i < messageSize-1; i++) {
if (s[i] == 0x00) {
s[i] = 0x0A;
}

View File

@@ -26,8 +26,8 @@ void AlertNotificationService::Init() {
ASSERT(res == 0);
}
AlertNotificationService::AlertNotificationService ( Pinetime::System::SystemTask& systemTask, Pinetime::Controllers::NotificationManager& notificationManager ) : m_systemTask{systemTask}, m_notificationManager{notificationManager},
characteristicDefinition{
AlertNotificationService::AlertNotificationService ( System::SystemTask& systemTask, NotificationManager& notificationManager )
: characteristicDefinition{
{
.uuid = (ble_uuid_t *) &ansCharUuid,
.access_cb = AlertNotificationCallback,
@@ -48,8 +48,7 @@ AlertNotificationService::AlertNotificationService ( Pinetime::System::SystemTas
{
0
},
}
{
}, m_systemTask{systemTask}, m_notificationManager{notificationManager} {
}
int AlertNotificationService::OnAlert(uint16_t conn_handle, uint16_t attr_handle,
@@ -67,7 +66,7 @@ int AlertNotificationService::OnAlert(uint16_t conn_handle, uint16_t attr_handle
char *s = (char *) &data[3];
auto messageSize = min(maxMessageSize, (bufferSize-3));
for (int i = 0; i < messageSize-1; i++) {
for (uint i = 0; i < messageSize-1; i++) {
if (s[i] == 0x00) {
s[i] = 0x0A;
}

View File

@@ -57,7 +57,7 @@ int CurrentTimeService::OnTimeAccessed(uint16_t conn_handle, uint16_t attr_handl
return 0;
}
CurrentTimeService::CurrentTimeService(DateTime &dateTimeController) : m_dateTimeController{dateTimeController},
CurrentTimeService::CurrentTimeService(DateTime &dateTimeController) :
characteristicDefinition{
{
.uuid = (ble_uuid_t *) &ctChrUuid,
@@ -80,8 +80,7 @@ CurrentTimeService::CurrentTimeService(DateTime &dateTimeController) : m_dateTim
{
0
},
}
{
}, m_dateTimeController{dateTimeController} {
}

View File

@@ -22,11 +22,11 @@ namespace Pinetime {
static constexpr uint16_t fwRevisionId {0x2a26};
static constexpr uint16_t hwRevisionId {0x2a27};
static constexpr char* manufacturerName = "Codingfield";
static constexpr char* modelNumber = "1";
static constexpr char* serialNumber = "9.8.7.6.5.4";
static constexpr char* fwRevision = "0.7.0";
static constexpr char* hwRevision = "1.0.0";
static constexpr const char* manufacturerName = "Codingfield";
static constexpr const char* modelNumber = "1";
static constexpr const char* serialNumber = "9.8.7.6.5.4";
static constexpr const char* fwRevision = "0.7.0";
static constexpr const char* hwRevision = "1.0.0";
static constexpr ble_uuid16_t deviceInfoUuid {
.u { .type = BLE_UUID_TYPE_16 },

View File

@@ -394,14 +394,14 @@ void DfuService::DfuImage::WriteMagicNumber() {
}
void DfuService::DfuImage::Erase() {
for (int erased = 0; erased < maxSize; erased += 0x1000) {
for (size_t erased = 0; erased < maxSize; erased += 0x1000) {
spiNorFlash.SectorErase(writeOffset + erased);
}
}
bool DfuService::DfuImage::Validate() {
uint32_t chunkSize = 200;
int currentOffset = 0;
size_t currentOffset = 0;
uint16_t crc = 0;
bool first = true;

View File

@@ -117,7 +117,6 @@ unsigned char Pinetime::Controllers::MusicService::status()
void Pinetime::Controllers::MusicService::event(char event)
{
auto *om = ble_hs_mbuf_from_flat(&event, 1);
int ret;
uint16_t connectionHandle = m_system.nimble().connHandle();
@@ -125,6 +124,6 @@ void Pinetime::Controllers::MusicService::event(char event)
return;
}
ret = ble_gattc_notify_custom(connectionHandle, m_eventHandle, om);
ble_gattc_notify_custom(connectionHandle, m_eventHandle, om);
}

View File

@@ -139,14 +139,13 @@ void NimbleController::StartAdvertising() {
rsp_fields.name_len = strlen("Pinetime-JF");
rsp_fields.name_is_complete = 1;
int res;
res = ble_gap_adv_set_fields(&fields);
ble_gap_adv_set_fields(&fields);
// ASSERT(res == 0); // TODO this one sometimes fails with error 22 (notsync)
res = ble_gap_adv_rsp_set_fields(&rsp_fields);
ble_gap_adv_rsp_set_fields(&rsp_fields);
// ASSERT(res == 0);
res = ble_gap_adv_start(addrType, NULL, 180000,
ble_gap_adv_start(addrType, NULL, 180000,
&adv_params, GAPEventCallback, this);
// ASSERT(res == 0);// TODO I've disabled these ASSERT as they sometime asserts and reset the mcu.
// For now, the advertising is restarted as soon as it ends. There may be a race condition

View File

@@ -43,7 +43,7 @@ namespace Pinetime {
uint16_t connHandle();
private:
static constexpr char* deviceName = "Pinetime-JF";
static constexpr const char* deviceName = "Pinetime-JF";
Pinetime::System::SystemTask& systemTask;
Pinetime::Controllers::Ble& bleController;
DateTime& dateTimeController;