From b0889ce270f1e4e3230eeb2b16a90f9d3db2e912 Mon Sep 17 00:00:00 2001 From: "Alexander St. John" Date: Thu, 1 Aug 2019 11:23:06 -0500 Subject: [PATCH 1/6] added functionality to log racer names --- .../blocks/Serial/lib/serial/src/impl/unix.cc | 2 +- apps/Silversprints/src/app/GFXMain.cpp | 18 ++++++++++++++- apps/Silversprints/src/data/Model.cpp | 4 ++++ .../SilverSprint.xcodeproj/project.pbxproj | 22 ++++++++++++++++++- libs/Cinder | 2 +- 5 files changed, 44 insertions(+), 4 deletions(-) diff --git a/apps/Silversprints/blocks/Serial/lib/serial/src/impl/unix.cc b/apps/Silversprints/blocks/Serial/lib/serial/src/impl/unix.cc index 0ff251e..611888a 100644 --- a/apps/Silversprints/blocks/Serial/lib/serial/src/impl/unix.cc +++ b/apps/Silversprints/blocks/Serial/lib/serial/src/impl/unix.cc @@ -613,7 +613,7 @@ Serial::SerialImpl::write (const uint8_t *data, size_t length) size_t bytes_written = 0; // Calculate total timeout in milliseconds t_c + (t_m * N) - long total_timeout_ms = timeout_.write_timeout_constant; + uint32_t total_timeout_ms = timeout_.write_timeout_constant; total_timeout_ms += timeout_.write_timeout_multiplier * static_cast (length); MillisecondTimer total_timeout(total_timeout_ms); diff --git a/apps/Silversprints/src/app/GFXMain.cpp b/apps/Silversprints/src/app/GFXMain.cpp index 6788c8d..31dcfc5 100644 --- a/apps/Silversprints/src/app/GFXMain.cpp +++ b/apps/Silversprints/src/app/GFXMain.cpp @@ -41,7 +41,11 @@ GFXMain::~GFXMain(){ void GFXMain::setup(){ // INIT -------------------------------------------------------------- mSerialReader = std::make_shared(); - CsvLogger::instance().setHeaders({"Timestamp", "Event", "Racer 1", "Racer 2", "Racer 3", "Racer 4"}); + if(Model::instance().getCurrentRaceType() == Model::RACE_TYPE::RACE_TYPE_DISTANCE){ + CsvLogger::instance().setHeaders({"Timestamp", "Event", "Racer 1", "Distance 1", "Racer 2", "Distance 2", "Racer 3", "Distance 3", "Racer 4", "Distance 4"}); + } else { + CsvLogger::instance().setHeaders({"Timestamp", "Event", "Racer 1", "Time 1", "Racer 2", "Time 2", "Racer 3", "Time 3", "Racer 4", "Time 4"}); + } // VIEWS -------------------------------------------------------------- mNav = std::make_shared(); @@ -91,24 +95,36 @@ void GFXMain::onRaceFinished() { // If it's a distance race, log the times if(Model::instance().getCurrentRaceType() == Model::RACE_TYPE::RACE_TYPE_DISTANCE){ CsvLogger::instance().log(CsvLogger::RACE_FINISH_DISTANCE, + Model::instance().playerData[0]->player_name, sb::utils::millisToTimestamp(Model::instance().playerData[0]->finishTimeMillis), + Model::instance().playerData[1]->player_name, sb::utils::millisToTimestamp(Model::instance().playerData[1]->finishTimeMillis), + Model::instance().playerData[2]->player_name, sb::utils::millisToTimestamp(Model::instance().playerData[2]->finishTimeMillis), + Model::instance().playerData[3]->player_name, sb::utils::millisToTimestamp(Model::instance().playerData[3]->finishTimeMillis)); } // If it's a time race, log the distance else { if(Model::instance().getUsesKph()){ CsvLogger::instance().log(CsvLogger::RACE_FINISH_TIME, + Model::instance().playerData[0]->player_name, Model::instance().playerData[0]->getDistanceMeters(), + Model::instance().playerData[1]->player_name, Model::instance().playerData[1]->getDistanceMeters(), + Model::instance().playerData[2]->player_name, Model::instance().playerData[2]->getDistanceMeters(), + Model::instance().playerData[3]->player_name, Model::instance().playerData[3]->getDistanceMeters()); }else{ CsvLogger::instance().log(CsvLogger::RACE_FINISH_TIME, + Model::instance().playerData[0]->player_name, Model::instance().playerData[0]->getDistanceFeet(), + Model::instance().playerData[1]->player_name, Model::instance().playerData[1]->getDistanceFeet(), + Model::instance().playerData[2]->player_name, Model::instance().playerData[2]->getDistanceFeet(), + Model::instance().playerData[3]->player_name, Model::instance().playerData[3]->getDistanceFeet()); } } diff --git a/apps/Silversprints/src/data/Model.cpp b/apps/Silversprints/src/data/Model.cpp index d917055..e8a1376 100644 --- a/apps/Silversprints/src/data/Model.cpp +++ b/apps/Silversprints/src/data/Model.cpp @@ -84,6 +84,10 @@ void Model::setRaceLength(int ticks) { } } +//void Model::setPlayerNames() { +// +//} + void Model::resetPlayers() { for( int i=0; ireset(); diff --git a/apps/Silversprints/xcode/SilverSprint.xcodeproj/project.pbxproj b/apps/Silversprints/xcode/SilverSprint.xcodeproj/project.pbxproj index f298821..cd5993a 100644 --- a/apps/Silversprints/xcode/SilverSprint.xcodeproj/project.pbxproj +++ b/apps/Silversprints/xcode/SilverSprint.xcodeproj/project.pbxproj @@ -555,7 +555,7 @@ 29B97313FDCFA39411CA2CEA /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0820; + LastUpgradeCheck = 1000; }; buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "SilverSprint" */; compatibilityVersion = "Xcode 3.2"; @@ -631,6 +631,7 @@ C01FCF4B08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; DEAD_CODE_STRIPPING = YES; @@ -657,6 +658,7 @@ C01FCF4C08A954540054247B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; COMBINE_HIDPI_IMAGES = YES; DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; @@ -687,14 +689,23 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CINDER_PATH = "../../..//libs/Cinder"; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "c++11"; CLANG_CXX_LIBRARY = "libc++"; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -723,14 +734,23 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CINDER_PATH = "../../..//libs/Cinder"; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "c++11"; CLANG_CXX_LIBRARY = "libc++"; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; diff --git a/libs/Cinder b/libs/Cinder index 4bc734c..0634d15 160000 --- a/libs/Cinder +++ b/libs/Cinder @@ -1 +1 @@ -Subproject commit 4bc734cba1e30fafd24cd24ab6e20b9e93c92ab3 +Subproject commit 0634d151a33b849d3284402a905e736e49fb50f1 From 631e34709d6210156c689ea99b84dd089fa03201 Mon Sep 17 00:00:00 2001 From: "Alexander St. John" Date: Thu, 1 Aug 2019 11:32:58 -0500 Subject: [PATCH 2/6] added racer name logging to csv --- apps/Silversprints/blocks/Serial/lib/serial/src/impl/unix.cc | 2 +- apps/Silversprints/src/data/Model.cpp | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/apps/Silversprints/blocks/Serial/lib/serial/src/impl/unix.cc b/apps/Silversprints/blocks/Serial/lib/serial/src/impl/unix.cc index 611888a..0ff251e 100644 --- a/apps/Silversprints/blocks/Serial/lib/serial/src/impl/unix.cc +++ b/apps/Silversprints/blocks/Serial/lib/serial/src/impl/unix.cc @@ -613,7 +613,7 @@ Serial::SerialImpl::write (const uint8_t *data, size_t length) size_t bytes_written = 0; // Calculate total timeout in milliseconds t_c + (t_m * N) - uint32_t total_timeout_ms = timeout_.write_timeout_constant; + long total_timeout_ms = timeout_.write_timeout_constant; total_timeout_ms += timeout_.write_timeout_multiplier * static_cast (length); MillisecondTimer total_timeout(total_timeout_ms); diff --git a/apps/Silversprints/src/data/Model.cpp b/apps/Silversprints/src/data/Model.cpp index e8a1376..d917055 100644 --- a/apps/Silversprints/src/data/Model.cpp +++ b/apps/Silversprints/src/data/Model.cpp @@ -84,10 +84,6 @@ void Model::setRaceLength(int ticks) { } } -//void Model::setPlayerNames() { -// -//} - void Model::resetPlayers() { for( int i=0; ireset(); From f45291cb3acf29a3858e0da26a6d209913693fdd Mon Sep 17 00:00:00 2001 From: deepfriedfilth Date: Tue, 28 Jan 2020 18:04:10 -0600 Subject: [PATCH 3/6] Add moar better README info re: cinder libs prereq --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5efd1f8..b0d9721 100644 --- a/README.md +++ b/README.md @@ -39,9 +39,9 @@ Please attach this file when asking for support along with any other relevant in ## Code Setup 1. Clone the repo with all of it's sumodules with: `git clone https://github.com/cwhitney/SilverSprint.git --depth 1 --recursive` -1. Build Cinder for your platform [OSX](https://libcinder.org/docs/guides/mac-setup/index.html) - [Windows](https://libcinder.org/docs/guides/windows-setup/index.html). +1. Build Cinder (with Cinder-OpenCV) for your platform [OSX](https://libcinder.org/docs/guides/mac-setup/index.html) - [Windows](https://libcinder.org/docs/guides/windows-setup/index.html). If you're having trouble building Cinder, it may be missing some of it's dependencies. You may need to run `git submodule update --init --recursive` to make sure Cinder has all of it's submodules. -2. The structure of the repo is like so: +2. The structure of the repo is like so: ``` Root @@ -50,6 +50,8 @@ Root - SilverSprint - libs - Cinder + - blocks + - Cinder-OpenCV ``` 3. Update Arduino if necessary. (See above) 4. Open the project file for your platform. It will be in `apps/SilverSprint/xcode/SilverSprint.xcodeproj` for OSX, and `appsSilverSprint/vs2015` for PC. From 926cc5e8991ec8c0b0b687b04cbf6c0a5eb2e066 Mon Sep 17 00:00:00 2001 From: deepfriedfilth Date: Tue, 28 Jan 2020 18:06:11 -0600 Subject: [PATCH 4/6] Add hotfix for typo in README (aka don't lie to Windows users, man) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b0d9721..58d54ad 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ Root - Cinder-OpenCV ``` 3. Update Arduino if necessary. (See above) -4. Open the project file for your platform. It will be in `apps/SilverSprint/xcode/SilverSprint.xcodeproj` for OSX, and `appsSilverSprint/vs2015` for PC. +4. Open the project file for your platform. It will be in `apps/SilverSprint/xcode/SilverSprint.xcodeproj` for OSX, and `apps/SilverSprint/vs2015` for PC. 5. Build Silversprints. There are no external dependencies aside from Cinder itself. ## Credits From eeca7825ff02416f4d6eafc06e7c71f6dd83e020 Mon Sep 17 00:00:00 2001 From: deepfriedfilth Date: Tue, 28 Jan 2020 18:23:09 -0600 Subject: [PATCH 5/6] =?UTF-8?q?Add=20a=20lil=20zhuzh=20to=20da=20README?= =?UTF-8?q?=E2=80=94=20just=20a=20pinch'll=20do?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 58d54ad..7354219 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Written in [Cinder](https://libcinder.org/), an opensource C++ library for creat ## Using the Application #### Requirements -* Requires OXS version 10.7 and up. +* Requires (±mac)OS X version 10.7 and up. * PC requires Windows 7 and up #### Installation @@ -17,13 +17,13 @@ Written in [Cinder](https://libcinder.org/), an opensource C++ library for creat 2. In the downlaoded zip file, there is an `Arduino` folder with software you'll need to load onto the OpenSprints hardware. Detailed instructions on how to do this can be found here: [http://cwhitney.github.io/SilverSprint/installation.html](http://cwhitney.github.io/SilverSprint/installation.html) #### App Settings -1. Go to the Settings page by clicking the gear icon or pressing Command + 3 +1. Go to the Settings page by clicking the gear icon or pressing + 3 2. Set the roller diameter as the distance from the magnet to the center of the roller multiplied by 2. 3. Choose the number of racers competing from 1-4 4. If SilverSprint detects an Arduino connected it will show a checkmark, otherwise it will display an X. #### Roster -1. Go to the Roster page by clicking the list icon or pressing Command + 2 +1. Go to the Roster page by clicking the list icon or pressing + 2 2. Set all active participants names #### Race @@ -39,7 +39,7 @@ Please attach this file when asking for support along with any other relevant in ## Code Setup 1. Clone the repo with all of it's sumodules with: `git clone https://github.com/cwhitney/SilverSprint.git --depth 1 --recursive` -1. Build Cinder (with Cinder-OpenCV) for your platform [OSX](https://libcinder.org/docs/guides/mac-setup/index.html) - [Windows](https://libcinder.org/docs/guides/windows-setup/index.html). +1. Build Cinder (with Cinder-OpenCV) for your platform [(±mac)OS X](https://libcinder.org/docs/guides/mac-setup/index.html) - [Windows](https://libcinder.org/docs/guides/windows-setup/index.html). If you're having trouble building Cinder, it may be missing some of it's dependencies. You may need to run `git submodule update --init --recursive` to make sure Cinder has all of it's submodules. 2. The structure of the repo is like so: From 31e0ce83597940f339936dff8a947dc0bda435ef Mon Sep 17 00:00:00 2001 From: deepfriedfilth Date: Tue, 28 Jan 2020 18:26:18 -0600 Subject: [PATCH 6/6] =?UTF-8?q?Revert=20superfluous=20zhuzh=20from=20keybo?= =?UTF-8?q?ard=20shortcuts=20since=20=E2=8C=98=20is=20illegible=20anyway?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7354219..862297d 100644 --- a/README.md +++ b/README.md @@ -17,13 +17,13 @@ Written in [Cinder](https://libcinder.org/), an opensource C++ library for creat 2. In the downlaoded zip file, there is an `Arduino` folder with software you'll need to load onto the OpenSprints hardware. Detailed instructions on how to do this can be found here: [http://cwhitney.github.io/SilverSprint/installation.html](http://cwhitney.github.io/SilverSprint/installation.html) #### App Settings -1. Go to the Settings page by clicking the gear icon or pressing + 3 +1. Go to the Settings page by clicking the gear icon or pressing Command + 3 2. Set the roller diameter as the distance from the magnet to the center of the roller multiplied by 2. 3. Choose the number of racers competing from 1-4 4. If SilverSprint detects an Arduino connected it will show a checkmark, otherwise it will display an X. #### Roster -1. Go to the Roster page by clicking the list icon or pressing + 2 +1. Go to the Roster page by clicking the list icon or pressing Command + 2 2. Set all active participants names #### Race