Skip to content

Conversation

@cujomalainey
Copy link
Owner

No description provided.

Copy link
Owner Author

@cujomalainey cujomalainey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently I can't request changes to myself since I authored this PR @Sepp62, but here are my comments. I am going to revamp my testing infra this next week (right now I have to book my main desktop into windows just to run Simulant+ when i prefer coding in linux) so I am going to try setting up a raspberry pi with windows so I can test easier.

#include "ANTPLUS.h"

#define BAUD_RATE 9600
#define CHANNEL_1 0
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CHANNEL_1 but defined as 0?

#define ANTPLUS_MUSCLEOXYGENPROFILEPRIVATEDEFINES_h

/* Channel Config */
#define ANTPLUS_MUSCLEOXYGEN_CHANNELTYPE CHANNEL_TYPE_BIDIRECTIONAL_RECEIVE
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ANTPLUS_MUSCLEOXYGEN_DISPLAY_CHANNELTYPE

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed

#define ANTPLUS_MUSCLEOXYGEN_DEVICETYPE 31
#define ANTPLUS_MUSCLEOXYGEN_CHANNELPERIOD 8192
// Master channel
#define ANTPLUS_MUSCLEOXYGEN_MASTER_CHANNELTYPE 0x10
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#define ANTPLUS_MUSCLEOXYGEN_MONITOR_CHANNELTYPE CHANNEL_TYPE_BIDIRECTIONAL_TRANSMIT

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed

// Master channel
#define ANTPLUS_MUSCLEOXYGEN_MASTER_CHANNELTYPE 0x10
#define ANTPLUS_MUSCLEOXYGEN_MASTER_TRANSMISSIONTYPE 5
#define ANTPLUS_MUSCLEOXYGEN_MASTER_DEVICENUMBER 5
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this for?

#define ANTPLUS_MUSCLEOXYGEN_SEARCHTIMEOUT 12

/* Pages */
#define ANTPLUS_MUSCLEOXYGEN_DATAPAGE_MUSCLEOXYGENDATA 1
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add _NUMBER

MuscleOxygenBaseMainDataPageMsg::MuscleOxygenBaseMainDataPageMsg(uint8_t dataPageNumber) : MuscleOxygenBaseGenericMsg()
{
_buffer[ANTPLUS_DEFAULT_DATAPAGE_BYTE] = dataPageNumber;
setCapabilities();
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment on other review about automating API :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dataPageNumber parameter removed.

void setTotalHemoglobinConcentration( uint16_t tc );
void setCurrentSaturatedHemoglobinPercentage(uint16_t cp);

// internal
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are these internal? Don't we want users to set these values?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"internal" removed

}

void ProfileMuscleOxygenMonitor::transmitNextDataPage() {
// some static aux messages
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm out of town (and off grid) in the mountains, but next week I'll do my best to fill in these missing common datapages on core/base-master and merge it into the shifter and moxy branches for you.

_patternStep = 0;

// debug
/*
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debug needs to be removed :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed


void ProfileMuscleOxygenMonitor::transmitMuscleOxygenMainPageMsg() {
MuscleOxygenBaseMainDataPageMsg msg;
msg.setEventCount( _eventCount );
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we can control this, if I'm reading the datasheet right, it should only increment when the sensor gets a new value, which is outside the libraries' control and depends on the moxy hardware.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed

@cujomalainey
Copy link
Owner Author

Oh also i forgot, both PRs I didn't check the bit math yet for the messages, not quite awake enough for that, will check that next version.

Copy link
Owner Author

@cujomalainey cujomalainey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely very close to being ready to merge 👍 bit math looks good

void setNotifications(uint8_t n = 0x00);
void setCapabilities(uint8_t c = 0x06);
void setEventCount(uint8_t n);
uint8_t * getBuffer() { return _buffer; }
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implemented by AntTxDataRequest :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

_buffer[5] |= (tc >> 8) & 0x0F;
}

/* TODO
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, what is missing here that needs the TODO?

Copy link
Contributor

@Sepp62 Sepp62 Jun 22, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The behaviour of "setPreviousSaturatedHemoglobinPercentage" cannot be verified with my moxy display device. So it is not clear for me, how to handle it from the application side. Of course, I read the antplus docs, but I do not have a clue about the use of it. Since I cannot test it, I commented it out to give somebody else a chance to use it.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the device just bumps the reading down. So on every event it moves the current value into previous and puts a new current. Docs site this reasoning for in the event of a data loss. It would be awesome if the class could handle this itself but since the class is never preserver I don't think there is a way around it other than showing the user through the example to do it themselves.

Copy link
Owner Author

@cujomalainey cujomalainey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few minor comments I can deal with, although there is the issue of the merge, but same comment applies as in the other PR, I can rebase and force push if you want :) just let me know.

msg.setTotalHemoglobinConcentration(_c);
msg.setCurrentSaturatedHemoglobinPercentage(_c++/4);
msg.setEventCount(_eventCount++);

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO to add "previous sat hemoglobin"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is a mystery to me and my moxy display. Somebody else should integrate it.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do

.DS_Store
.tags*
tags
examples/BikeSensorConverter/arduino_secrets.h
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like the same merge happened here as well.


MuscleOxygenBaseMainDataPageMsg::MuscleOxygenBaseMainDataPageMsg(uint8_t dataPageNumber) : BaseDataPageMsg<BroadcastDataMsg>()
{
memset(_buffer, 0, MESSAGE_SIZE);
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious what the benefit of memsetting the values are :) All values in the datapage should be defined so we shouldnt be left with an 0s.

Copy link
Contributor

@Sepp62 Sepp62 Jun 22, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

During development, you cannot be sure to have all the bytes in a defined state. Initializing with "0" makes it easier to see bugs in bit math. Generally spoken: Initializing member data has very low cost and pays off during develplement and maintenance life cycle. In our special case "moxy" setPreviousSaturatedHemoglobinPercentage is unused and therefore a default initialization is helpful.

Copy link
Owner Author

@cujomalainey cujomalainey Jun 22, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair point, I think though I would just set it to 0 it out in the variable declaration.

*edit fair

@cujomalainey
Copy link
Owner Author

Going to merge, rebase then force push. The merge will disappear as in shifting but commits will be preserved.

@cujomalainey cujomalainey merged commit 7b2912c into cujomalainey:profiles/moxy/monitor Jun 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants