From e44a8e78e7d9dcdc524efe7aebc4b3514c34f7be Mon Sep 17 00:00:00 2001 From: ion098 <146852218+ion098@users.noreply.github.com> Date: Wed, 11 Sep 2024 10:20:03 -0700 Subject: [PATCH 01/13] Update Makefile to correct version --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 10d24a2..b45e5ae 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,7 @@ EXCLUDE_COLD_LIBRARIES:= IS_LIBRARY:=1 # TODO: CHANGE THIS! LIBNAME:=gamepad -VERSION:=0.0.1 +VERSION:=0.1.0 # EXCLUDE_SRC_FROM_LIB= $(SRCDIR)/unpublishedfile.c # this line excludes opcontrol.c and similar files EXCLUDE_SRC_FROM_LIB+=$(foreach file, $(SRCDIR)/main,$(foreach cext,$(CEXTS),$(file).$(cext)) $(foreach cxxext,$(CXXEXTS),$(file).$(cxxext))) From 11033a605a7a602b53b2b7a26284b952a48a7194 Mon Sep 17 00:00:00 2001 From: lufimio <67525443+PA055@users.noreply.github.com> Date: Thu, 3 Oct 2024 21:04:15 -0400 Subject: [PATCH 02/13] feat: :sparkles: added onLongRelease and onRepeatPressEvents Issue #14 --- include/gamepad/button.hpp | 56 ++++++++++++++++++++++++++++++++++++-- src/gamepad/button.cpp | 21 +++++++++++++- 2 files changed, 74 insertions(+), 3 deletions(-) diff --git a/include/gamepad/button.hpp b/include/gamepad/button.hpp index f1126d3..0e4534f 100644 --- a/include/gamepad/button.hpp +++ b/include/gamepad/button.hpp @@ -1,5 +1,7 @@ #pragma once +#include +#include #include #include "event_handler.hpp" @@ -10,6 +12,8 @@ enum EventType { ON_LONG_PRESS, ON_RELEASE, ON_SHORT_RELEASE, + ON_LONG_RELEASE, + ON_REPEAT_PRESS, }; class Button { @@ -25,8 +29,12 @@ class Button { uint32_t time_held = 0; /// How long the button has been released uint32_t time_released = 0; + // How many times the button has been repeat-pressed + uint32_t repeat_iterations = 0; /// How long the threshold should be for the longPress and shortRelease events uint32_t long_press_threshold = 500; + // How often the repeatPress is called + uint32_t repeat_cooldown = 50; /** * @brief Register a function to run when the button is pressed. * @@ -103,10 +111,50 @@ class Button { * // Use a function... * gamepad::master.A.onShortRelease("raiseLiftOneLevel", raiseLiftOneLevel); * // ...or a lambda - * gamepad::master.B.onShortRelease("intakeOnePicce", []() { intake.move_relative(600, 100); }); + * gamepad::master.B.onShortRelease("intakeOnePiece", []() { intake.move_relative(600, 100); }); * @endcode */ bool onShortRelease(std::string listenerName, std::function func) const; + /** + * @brief Register a function to run when the button is long released. + * By default, longRelease will fire when the button has been released after 500ms, this threshold can be + * adjusted by changing long_press_threshold. + * + * @param listenerName The name of the listener, this must be a unique name + * @param func The function to run when the button is long released, the function MUST NOT block + * @return true The listener was successfully registered + * @return false The listener was not successfully registered (there is already a listener with this name) + * + * @b Example: + * @code {.cpp} + * // Use a function... + * gamepad::master.A.onLongRelease("moveLiftToGround", moveLiftToGround); + * // ...or a lambda + * gamepad::master.B.onLongRelease("spinIntake", []() { intake.move(127); }); + * @endcode + * + */ + bool onLongRelease(std::string listenerName, std::function func) const; + /** + * @brief Register a function to run periodically after its been held + * By default repeatPress will start repeating after 500ms and repeat every 50ms, this can be changed by + * adjusting long_press_threshold and repeat_cooldown respectivly + * + * @param listenerName The name of the listener, this must be a unique name + * @param func the function to run periodically when the button is held, the function MUST NOT block + * @return true The listener was successfully registered + * @return false The listener was not successfully registered (there is already a listener with this name) + * + * @b Example: + * @code {.cpp} + * // Use a function... + * gamepad::master.A.onRepeatPress("shootDisk", shootOneDisk); + * // ...or a lambda + * gamepad::master.B.onRepeatPress("scoreOneRing", []() { intake.move_relative(200, 100); }); + * @endcode + * + */ + bool onRepeatPress(std::string listenerName, std::function func) const; /** * @brief Register a function to run for a given event. * @@ -157,13 +205,17 @@ class Button { * @param is_held Whether or not the button is currently held down */ void update(bool is_held); - /// he last time the update function was called + /// The last time the update function was called uint32_t last_update_time = pros::millis(); /// The last time the long press event was fired uint32_t last_long_press_time = 0; + // The last time the repeat event was called + uint32_t last_repeat_time = 0; mutable _impl::EventHandler onPressEvent {}; mutable _impl::EventHandler onLongPressEvent {}; mutable _impl::EventHandler onReleaseEvent {}; mutable _impl::EventHandler onShortReleaseEvent {}; + mutable _impl::EventHandler onLongReleaseEvent {}; + mutable _impl::EventHandler onRepeatPressEvent {}; }; } // namespace gamepad \ No newline at end of file diff --git a/src/gamepad/button.cpp b/src/gamepad/button.cpp index 74dfc66..907a07f 100644 --- a/src/gamepad/button.cpp +++ b/src/gamepad/button.cpp @@ -19,6 +19,14 @@ bool Button::onShortRelease(std::string listenerName, std::function return this->onShortReleaseEvent.add_listener(std::move(listenerName) + "_user", std::move(func)); } +bool Button::onLongRelease(std::string listenerName, std::function func) const { + return this->onLongReleaseEvent.add_listener(std::move(listenerName) + "_user", std::move(func)); +} + +bool Button::onRepeatPress(std::string listenerName, std::function func) const { + return this->onRepeatPressEvent.add_listener(std::move(listenerName) + "_user", std::move(func)); +} + bool Button::addListener(EventType event, std::string listenerName, std::function func) const { switch (event) { case gamepad::EventType::ON_PRESS: return this->onPress(std::move(listenerName), std::move(func)); @@ -26,6 +34,8 @@ bool Button::addListener(EventType event, std::string listenerName, std::functio case gamepad::EventType::ON_RELEASE: return this->onRelease(std::move(listenerName), std::move(func)); case gamepad::EventType::ON_SHORT_RELEASE: return this->onShortRelease(std::move(listenerName), std::move(func)); + case gamepad::EventType::ON_LONG_RELEASE: return this->onLongRelease(std::move(listenerName), std::move(func)); + case gamepad::EventType::ON_REPEAT_PRESS: return this->onRepeatPress(std::move(listenerName), std::move(func)); default: TODO("add error logging") errno = EINVAL; @@ -37,7 +47,9 @@ bool Button::removeListener(std::string listenerName) const { return this->onPressEvent.remove_listener(listenerName + "_user") || this->onLongPressEvent.remove_listener(listenerName + "_user") || this->onReleaseEvent.remove_listener(listenerName + "_user") || - this->onShortReleaseEvent.remove_listener(listenerName + "_user"); + this->onShortReleaseEvent.remove_listener(listenerName + "_user") || + this->onLongReleaseEvent.remove_listener(listenerName + "_user") || + this->onRepeatPressEvent.remove_listener(listenerName + "_user"); } void Button::update(const bool is_held) { @@ -53,9 +65,16 @@ void Button::update(const bool is_held) { this->last_long_press_time <= pros::millis() - this->time_held) { this->onLongPressEvent.fire(); this->last_long_press_time = pros::millis(); + this->last_repeat_time = pros::millis(); + this->repeat_iterations = 0; + } else if (this->is_pressed && this->time_held >= this->long_press_threshold && pros::millis() - this->last_repeat_time > this->repeat_cooldown) { + this->repeat_iterations++; + this->onRepeatPressEvent.fire(); + this->last_repeat_time = pros::millis(); } else if (this->falling_edge) { this->onReleaseEvent.fire(); if (this->time_held < this->long_press_threshold) this->onShortReleaseEvent.fire(); + else this->onLongReleaseEvent.fire(); } if (this->rising_edge) this->time_held = 0; if (this->falling_edge) this->time_released = 0; From e178dff2b1ad937f801fa7183da2692ccb481785 Mon Sep 17 00:00:00 2001 From: lufimio <67525443+PA055@users.noreply.github.com> Date: Sat, 5 Oct 2024 13:56:29 -0400 Subject: [PATCH 03/13] Update button.hpp Co-authored-by: ion098 <146852218+ion098@users.noreply.github.com> --- include/gamepad/button.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/include/gamepad/button.hpp b/include/gamepad/button.hpp index 0e4534f..ec6e43e 100644 --- a/include/gamepad/button.hpp +++ b/include/gamepad/button.hpp @@ -117,6 +117,7 @@ class Button { bool onShortRelease(std::string listenerName, std::function func) const; /** * @brief Register a function to run when the button is long released. + * * By default, longRelease will fire when the button has been released after 500ms, this threshold can be * adjusted by changing long_press_threshold. * From 209da573a36246d10d52316464d0a6ffbb2c105b Mon Sep 17 00:00:00 2001 From: lufimio <67525443+PA055@users.noreply.github.com> Date: Sat, 5 Oct 2024 13:56:34 -0400 Subject: [PATCH 04/13] Update button.hpp Co-authored-by: ion098 <146852218+ion098@users.noreply.github.com> --- include/gamepad/button.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/gamepad/button.hpp b/include/gamepad/button.hpp index ec6e43e..f5fc34f 100644 --- a/include/gamepad/button.hpp +++ b/include/gamepad/button.hpp @@ -138,8 +138,9 @@ class Button { bool onLongRelease(std::string listenerName, std::function func) const; /** * @brief Register a function to run periodically after its been held + * * By default repeatPress will start repeating after 500ms and repeat every 50ms, this can be changed by - * adjusting long_press_threshold and repeat_cooldown respectivly + * adjusting long_press_threshold and repeat_cooldown respectively * * @param listenerName The name of the listener, this must be a unique name * @param func the function to run periodically when the button is held, the function MUST NOT block From b7845251fb42bc48ecea545b18b0c254da63407d Mon Sep 17 00:00:00 2001 From: lufimio <67525443+PA055@users.noreply.github.com> Date: Sat, 5 Oct 2024 13:56:39 -0400 Subject: [PATCH 05/13] Update button.hpp Co-authored-by: ion098 <146852218+ion098@users.noreply.github.com> --- include/gamepad/button.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/gamepad/button.hpp b/include/gamepad/button.hpp index f5fc34f..6d23b3f 100644 --- a/include/gamepad/button.hpp +++ b/include/gamepad/button.hpp @@ -29,7 +29,7 @@ class Button { uint32_t time_held = 0; /// How long the button has been released uint32_t time_released = 0; - // How many times the button has been repeat-pressed + /// How many times the button has been repeat-pressed uint32_t repeat_iterations = 0; /// How long the threshold should be for the longPress and shortRelease events uint32_t long_press_threshold = 500; From 0243c37bd8f8ce29423b6d4ad005217e1c969fbd Mon Sep 17 00:00:00 2001 From: lufimio <67525443+PA055@users.noreply.github.com> Date: Sat, 5 Oct 2024 13:56:46 -0400 Subject: [PATCH 06/13] Update button.hpp Co-authored-by: ion098 <146852218+ion098@users.noreply.github.com> --- include/gamepad/button.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/gamepad/button.hpp b/include/gamepad/button.hpp index 6d23b3f..fee1471 100644 --- a/include/gamepad/button.hpp +++ b/include/gamepad/button.hpp @@ -33,7 +33,7 @@ class Button { uint32_t repeat_iterations = 0; /// How long the threshold should be for the longPress and shortRelease events uint32_t long_press_threshold = 500; - // How often the repeatPress is called + /// How often repeatPress is called uint32_t repeat_cooldown = 50; /** * @brief Register a function to run when the button is pressed. From 7c5845fce4544aa3c7c1f6d593671630623280e3 Mon Sep 17 00:00:00 2001 From: lufimio <67525443+PA055@users.noreply.github.com> Date: Sun, 6 Oct 2024 17:49:58 -0400 Subject: [PATCH 07/13] style: :art: run clang-format --- src/gamepad/button.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gamepad/button.cpp b/src/gamepad/button.cpp index 907a07f..7cd7eb3 100644 --- a/src/gamepad/button.cpp +++ b/src/gamepad/button.cpp @@ -67,7 +67,8 @@ void Button::update(const bool is_held) { this->last_long_press_time = pros::millis(); this->last_repeat_time = pros::millis(); this->repeat_iterations = 0; - } else if (this->is_pressed && this->time_held >= this->long_press_threshold && pros::millis() - this->last_repeat_time > this->repeat_cooldown) { + } else if (this->is_pressed && this->time_held >= this->long_press_threshold && + pros::millis() - this->last_repeat_time > this->repeat_cooldown) { this->repeat_iterations++; this->onRepeatPressEvent.fire(); this->last_repeat_time = pros::millis(); From 510b15161cc82dafe32f31fc8d7cf16714e5e26a Mon Sep 17 00:00:00 2001 From: lufimio <67525443+PA055@users.noreply.github.com> Date: Sun, 6 Oct 2024 19:08:29 -0400 Subject: [PATCH 08/13] fix: :bug: made it possible to change `long_press_threshold` and `repeat_cooldown` --- include/gamepad/button.hpp | 65 ++++++++++++++++++++++++++++++-------- src/gamepad/button.cpp | 15 +++++++-- src/main.cpp | 26 ++++++++++++++- 3 files changed, 89 insertions(+), 17 deletions(-) diff --git a/include/gamepad/button.hpp b/include/gamepad/button.hpp index fee1471..b867da7 100644 --- a/include/gamepad/button.hpp +++ b/include/gamepad/button.hpp @@ -31,10 +31,43 @@ class Button { uint32_t time_released = 0; /// How many times the button has been repeat-pressed uint32_t repeat_iterations = 0; - /// How long the threshold should be for the longPress and shortRelease events - uint32_t long_press_threshold = 500; - /// How often repeatPress is called - uint32_t repeat_cooldown = 50; + /** + * @brief Set the time for a press to be considered a long press for the button + * + * @note this is likely to be used with the onLongPress(), onShortRelease(), onLongRelease(), or onRepeatPress() + * events + * + * @param threshold the time in ms that would be considered a long press + * + * @b Example: + * @code {.cpp} + * // change the threshold + * gamepad::master.Left.set_long_press_threshold(5000); + * // then call the function + * gamepad::master.Left.onLongPress("longPress1", []() { + * std::cout << "I was held for 5000ms instead of the 500ms default!" << std::endl; + * }); + * @endcode + */ + void set_long_press_threshold(uint32_t threshold) const; + /** + * @brief Set the interval for the repeatPress event to repeat + * + * @note this is likely to be used with the onRepeatPress() event + * + * @param cooldown the interval in ms + * + * @b Example: + * @code {.cpp} + * // change the threshold + * gamepad::master.Up.set_repeat_cooldown(100); + * // then call the function + * gamepad::master.Up.onRepeatPress("repeatPress1", []() { + * std::cout << "I'm being repeated every 100ms instead of the 50ms default!" << std::endl; + * }); + * @endcode + */ + void set_repeat_cooldown(uint32_t cooldown) const; /** * @brief Register a function to run when the button is pressed. * @@ -56,7 +89,7 @@ class Button { * @brief Register a function to run when the button is long pressed. * * By default, onLongPress will fire when the button has been held down for - * 500ms or more, this threshold can be adjusted by changing long_press_threshold. + * 500ms or more, this threshold can be adjusted via the set_long_press_threshold() method. * * @warning When using this event along with onPress, both the onPress * and onlongPress listeners may fire together. @@ -97,7 +130,7 @@ class Button { * @brief Register a function to run when the button is short released. * * By default, shortRelease will fire when the button has been released before 500ms, this threshold can be - * adjusted by changing long_press_threshold. + * adjusted via the set_long_press_threshold() method. * * @note This event will most likely be used along with the longPress event. * @@ -119,7 +152,7 @@ class Button { * @brief Register a function to run when the button is long released. * * By default, longRelease will fire when the button has been released after 500ms, this threshold can be - * adjusted by changing long_press_threshold. + * adjusted via the set_long_press_threshold() method. * * @param listenerName The name of the listener, this must be a unique name * @param func The function to run when the button is long released, the function MUST NOT block @@ -129,9 +162,9 @@ class Button { * @b Example: * @code {.cpp} * // Use a function... - * gamepad::master.A.onLongRelease("moveLiftToGround", moveLiftToGround); + * gamepad::master.Up.onLongRelease("moveLiftToGround", moveLiftToGround); * // ...or a lambda - * gamepad::master.B.onLongRelease("spinIntake", []() { intake.move(127); }); + * gamepad::master.Left.onLongRelease("spinIntake", []() { intake.move(127); }); * @endcode * */ @@ -139,8 +172,8 @@ class Button { /** * @brief Register a function to run periodically after its been held * - * By default repeatPress will start repeating after 500ms and repeat every 50ms, this can be changed by - * adjusting long_press_threshold and repeat_cooldown respectively + * By default repeatPress will start repeating after 500ms and repeat every 50ms, this can be adjusted via the + * set_long_press_threshold() and set_repeat_cooldown() methods respectively * * @param listenerName The name of the listener, this must be a unique name * @param func the function to run periodically when the button is held, the function MUST NOT block @@ -150,9 +183,9 @@ class Button { * @b Example: * @code {.cpp} * // Use a function... - * gamepad::master.A.onRepeatPress("shootDisk", shootOneDisk); + * gamepad::master.X.onRepeatPress("shootDisk", shootOneDisk); * // ...or a lambda - * gamepad::master.B.onRepeatPress("scoreOneRing", []() { intake.move_relative(200, 100); }); + * gamepad::master.A.onRepeatPress("scoreOneRing", []() { intake.move_relative(200, 100); }); * @endcode * */ @@ -207,11 +240,15 @@ class Button { * @param is_held Whether or not the button is currently held down */ void update(bool is_held); + /// How long the threshold should be for the longPress and shortRelease events + mutable uint32_t long_press_threshold = 500; + /// How often repeatPress is called + mutable uint32_t repeat_cooldown = 50; /// The last time the update function was called uint32_t last_update_time = pros::millis(); /// The last time the long press event was fired uint32_t last_long_press_time = 0; - // The last time the repeat event was called + /// The last time the repeat event was called uint32_t last_repeat_time = 0; mutable _impl::EventHandler onPressEvent {}; mutable _impl::EventHandler onLongPressEvent {}; diff --git a/src/gamepad/button.cpp b/src/gamepad/button.cpp index 7cd7eb3..127aaca 100644 --- a/src/gamepad/button.cpp +++ b/src/gamepad/button.cpp @@ -1,8 +1,18 @@ #include "gamepad/button.hpp" #include "gamepad/todo.hpp" #include "pros/rtos.hpp" +#include +#include namespace gamepad { +void Button::set_long_press_threshold(uint32_t threshold) const { + this->long_press_threshold = threshold; +} + +void Button::set_repeat_cooldown(uint32_t cooldown) const { + this->repeat_cooldown = cooldown; +} + bool Button::onPress(std::string listenerName, std::function func) const { return this->onPressEvent.add_listener(std::move(listenerName) + "_user", std::move(func)); } @@ -65,10 +75,10 @@ void Button::update(const bool is_held) { this->last_long_press_time <= pros::millis() - this->time_held) { this->onLongPressEvent.fire(); this->last_long_press_time = pros::millis(); - this->last_repeat_time = pros::millis(); + this->last_repeat_time = pros::millis() - this->repeat_cooldown; this->repeat_iterations = 0; } else if (this->is_pressed && this->time_held >= this->long_press_threshold && - pros::millis() - this->last_repeat_time > this->repeat_cooldown) { + pros::millis() - this->last_repeat_time >= this->repeat_cooldown) { this->repeat_iterations++; this->onRepeatPressEvent.fire(); this->last_repeat_time = pros::millis(); @@ -77,6 +87,7 @@ void Button::update(const bool is_held) { if (this->time_held < this->long_press_threshold) this->onShortReleaseEvent.fire(); else this->onLongReleaseEvent.fire(); } + if (this->rising_edge) this->time_held = 0; if (this->falling_edge) this->time_released = 0; this->last_update_time = pros::millis(); diff --git a/src/main.cpp b/src/main.cpp index e3da78e..b0bef76 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,5 +1,9 @@ #include "main.h" #include "gamepad/api.hpp" +#include "gamepad/controller.hpp" +#include "pros/rtos.hpp" +#include +#include /** * Runs initialization code. This occurs as soon as the program is started. @@ -8,6 +12,8 @@ * to keep execution time for this mode under a few seconds. */ +uint32_t last_repeat_press_time = pros::millis(); + void downPress1() { printf("Down Press!\n"); } void upRelease1() { printf("Up Release!\n"); } @@ -16,6 +22,18 @@ void leftLongPress1() { printf("Left Long Press!\n"); } void leftShortRelease1() { printf("Left Short Release!\n"); } +void leftLongRelease1() { printf("Left Long Release!\n"); } + +void aPress1() { + last_repeat_press_time = pros::millis(); + printf("A Pressed!\n"); +} + +void aRepeatPress1() { + printf("A Repeat Pressed %ims after last\n", pros::millis() - last_repeat_press_time); + last_repeat_press_time = pros::millis(); +} + void initialize() { // We can register functions to run when buttons are pressed gamepad::master.Down.onPress("downPress1", downPress1); @@ -23,9 +41,15 @@ void initialize() { gamepad::master.Up.onRelease("downRelease1", upRelease1); // There's also the longPress event gamepad::master.Left.onLongPress("leftLongPress1", leftLongPress1); - // We can have two functions on one button, + // We can have two or even more functions on one button, // just remember to give them different names gamepad::master.Left.onShortRelease("leftShortRelease", leftShortRelease1); + gamepad::master.Left.onLongRelease("leftLongRelease", leftLongRelease1); + // We also have the repeat press event, where we can adjust the timing + gamepad::master.A.set_long_press_threshold(1000); // in ms + gamepad::master.A.set_repeat_cooldown(100); // in ms + gamepad::master.A.onPress("aStartPress", aPress1); + gamepad::master.A.onRepeatPress("aRepeatPress", aRepeatPress1); // And we can use lambda's too gamepad::master.X.onShortRelease("xShortRelease1", []() { printf("X Short Release!\n"); }); } From 9f0bdaa4b13cf4eb4e0c5d573cdb1efa5c5a0615 Mon Sep 17 00:00:00 2001 From: lufimio <67525443+PA055@users.noreply.github.com> Date: Thu, 10 Oct 2024 20:30:40 -0400 Subject: [PATCH 09/13] style: :art: run clang-format --- src/gamepad/button.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/gamepad/button.cpp b/src/gamepad/button.cpp index 127aaca..703c246 100644 --- a/src/gamepad/button.cpp +++ b/src/gamepad/button.cpp @@ -5,13 +5,9 @@ #include namespace gamepad { -void Button::set_long_press_threshold(uint32_t threshold) const { - this->long_press_threshold = threshold; -} +void Button::set_long_press_threshold(uint32_t threshold) const { this->long_press_threshold = threshold; } -void Button::set_repeat_cooldown(uint32_t cooldown) const { - this->repeat_cooldown = cooldown; -} +void Button::set_repeat_cooldown(uint32_t cooldown) const { this->repeat_cooldown = cooldown; } bool Button::onPress(std::string listenerName, std::function func) const { return this->onPressEvent.add_listener(std::move(listenerName) + "_user", std::move(func)); From 053966f0a4a48d95bec9579b29c7f7611703fce2 Mon Sep 17 00:00:00 2001 From: ion098 <146852218+ion098@users.noreply.github.com> Date: Fri, 25 Oct 2024 09:24:48 -0700 Subject: [PATCH 10/13] Bump version to 0.1.1 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 10d24a2..d17b3b1 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,7 @@ EXCLUDE_COLD_LIBRARIES:= IS_LIBRARY:=1 # TODO: CHANGE THIS! LIBNAME:=gamepad -VERSION:=0.0.1 +VERSION:=0.1.1 # EXCLUDE_SRC_FROM_LIB= $(SRCDIR)/unpublishedfile.c # this line excludes opcontrol.c and similar files EXCLUDE_SRC_FROM_LIB+=$(foreach file, $(SRCDIR)/main,$(foreach cext,$(CEXTS),$(file).$(cext)) $(foreach cxxext,$(CXXEXTS),$(file).$(cxxext))) From 8b58786f3c2a214b298e11f3071357e9f1cc8edb Mon Sep 17 00:00:00 2001 From: ion098 <146852218+ion098@users.noreply.github.com> Date: Fri, 25 Oct 2024 09:30:40 -0700 Subject: [PATCH 11/13] chore: :pencil: bump version to correct version (0.2.0) --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index d17b3b1..4d59c1f 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,7 @@ EXCLUDE_COLD_LIBRARIES:= IS_LIBRARY:=1 # TODO: CHANGE THIS! LIBNAME:=gamepad -VERSION:=0.1.1 +VERSION:=0.2.0 # EXCLUDE_SRC_FROM_LIB= $(SRCDIR)/unpublishedfile.c # this line excludes opcontrol.c and similar files EXCLUDE_SRC_FROM_LIB+=$(foreach file, $(SRCDIR)/main,$(foreach cext,$(CEXTS),$(file).$(cext)) $(foreach cxxext,$(CXXEXTS),$(file).$(cxxext))) From e22f373c1b8cf3a3caa77c87d67c4cfd9021c83d Mon Sep 17 00:00:00 2001 From: ion098 <146852218+ion098@users.noreply.github.com> Date: Mon, 28 Oct 2024 11:20:52 -0700 Subject: [PATCH 12/13] ci: :green_heart: Upload template zip on build --- .github/workflows/pros-build.yml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pros-build.yml b/.github/workflows/pros-build.yml index 88566b5..d34f97d 100644 --- a/.github/workflows/pros-build.yml +++ b/.github/workflows/pros-build.yml @@ -12,7 +12,16 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: LemLib/pros-build@v2.0.2 + - name: Checkout Code + uses: actions/checkout@v4 + - name: Build Template + id: build_step + uses: LemLib/pros-build@v2.0.2 with: - library-path: gamepad + lib_folder_name: "gamepad" + copy_readme_and_license_to_include: true + - name: Upload Artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ steps.build_step.outputs.name }} + path: ${{ github.workspace }}/template/* From 640015551fab15d8adf15ad2350d8db12334f13f Mon Sep 17 00:00:00 2001 From: ion098 <146852218+ion098@users.noreply.github.com> Date: Mon, 28 Oct 2024 11:21:43 -0700 Subject: [PATCH 13/13] ci: :construction_worker: Build and upload template on release --- .github/workflows/pros-build-release.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/pros-build-release.yml diff --git a/.github/workflows/pros-build-release.yml b/.github/workflows/pros-build-release.yml new file mode 100644 index 0000000..301a532 --- /dev/null +++ b/.github/workflows/pros-build-release.yml @@ -0,0 +1,24 @@ +name: Build Release + +on: + release: + types: [published] + +jobs: + build-release: + runs-on: ubuntu-latest + + steps: + - name: Checkout Code + uses: actions/checkout@v4 + - name: Build Template + id: build_step + uses: LemLib/pros-build@v2.0.2 + with: + lib_folder_name: "gamepad" + copy_readme_and_license_to_include: true + no_commit_hash: true + - name: Upload Template To Release + uses: svenstaro/upload-release-action@v2 + with: + file: ${{ github.workspace }}/${{ steps.build_step.outputs.name }}