Skip to content

refactored appendTestData#327

Merged
Joseph-Jacobson merged 9 commits intomasterfrom
1.12.1.feat-appendTestData
Jul 1, 2025
Merged

refactored appendTestData#327
Joseph-Jacobson merged 9 commits intomasterfrom
1.12.1.feat-appendTestData

Conversation

@Joseph-Jacobson
Copy link
Contributor

@Joseph-Jacobson Joseph-Jacobson commented May 28, 2025

Description

Requirements

  • XPlat_Utils pull#28

  • Notes for Reviewer

  • This change removes the previous sawtooth logic, replacing it with a function call to "createTestDataPacket" in EmotiBitPacket which will be building the test packets for EmotiBit.cpp. It is also wrapped in a conditional to check if recording has begun, ensuring our SD card files follow the determined results from EmotiBitPacket

Testing

Results

###MockDataTest

ESP32

MockDataTestSuccessESP32

M0

MockDataTestSuccessM0

Feature Tests

None

Shared files

  • Firmware binary: [Link to firmware binary]
    None
  • Other files.
    None

Checklist to allow merge

  • All dependent repositories used were on branch master
  • Software
    • Get approval from the reviewer
    • Passed testing on Windows
    • Passed testing on macOS (for major changes/GUI changes/ PRs adding files distributed with the EmotiBit software)
    • Passed testing on linux (ubuntu) (for major changes/GUI changes/ PRs adding files distributed with the EmotiBit software)
    • Update software bundle version in ofxEmotiBitVersion.h
  • Firmware
    • Set testingMode to TestingMode::NONE
    • Set const bool DIGITAL_WRITE_DEBUG = false (if set true while testing)
    • Update version in EmotiBit.h
    • Update library.properties to the correct version (should match EmotiBit.h)
  • doxygen style comments included for new code snippets
  • Required documentation updated

Screenshots:

@Joseph-Jacobson Joseph-Jacobson marked this pull request as ready for review May 30, 2025 20:17
Copy link
Collaborator

@nitin710 nitin710 left a comment

Choose a reason for hiding this comment

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

Left some comments. Let me know if you want to talk about anything.

EmotiBit.cpp Outdated
@@ -3839,25 +3839,8 @@ void EmotiBit::updateBatteryIndication(float battPercent)

void EmotiBit::appendTestData(String &dataMessage, uint16_t &packetNumber)
Copy link
Collaborator

Choose a reason for hiding this comment

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

If we are not using the second parameter packetNumber, do we need that in this function signature?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also, not that the new appendTestData is no longer "appending". It is setting dataMessage to "" and filling in the new test data.

Can you think of a reason why we might not want to do that? I'm thinking, if there is any reason to preserve the data in dataMessage, at the time appendTestData is being called. If there is a case, we want to pass down the packetNumber to appendTestData?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Edited with relevent changes

EmotiBit.h Outdated

void updateBatteryIndication(float battPercent);
void appendTestData(String &dataMessage, uint16_t &packetNumber);
void setTestData(String &dataMessage);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why not call the function sendTestData?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Add doxygen comments too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

_sendTestData is a bool flag so that naming could be confusing. I named it setTestData because we are setting dataMessage with setTestData from createTestDataPacket in EmotiBit Packet. The current setTestData function doesn't actually send the data either, that comes from sendData.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't like set. It usually connotes "setting something", more like in the class of "getters" and "setters". It almost feels like we *should be* setting a bool or something.
Also, by that logic, this function may be more accurately called getTestData? because we are getting test Data for dataMessage?

How about addTestData? It tries to replicate the addPacket in the sendData function.
Key point to note that, processTestData works on the buffers and send test data empties the buffers and creates a packet+adds that to outDataMessage.

What we are doing is essentially the same, create a packet and add to outDataMessage.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I like addTestData, will be making that change

EmotiBit.h Outdated
void updateBatteryIndication(float battPercent);
void appendTestData(String &dataMessage, uint16_t &packetNumber);
/**
* @brief Sets dataMessage to the test packet string
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this now be "Adds test packet string to dataMessage"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes!

@Joseph-Jacobson Joseph-Jacobson merged commit f48eeaa into master Jul 1, 2025
@nitin710 nitin710 deleted the 1.12.1.feat-appendTestData branch October 16, 2025 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants