Skip to content

Commit

Permalink
changed IS_SD_CARD to conform to EZ-Robotics#65
Browse files Browse the repository at this point in the history
  • Loading branch information
mkhlb committed Oct 24, 2022
1 parent 248d3d5 commit 7f2dfe4
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions docs/Docs/util.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,17 +164,17 @@ void opcontrol() {
---


## IS_SD_CARD
## SD_CARD_ACTIVE
Boolean that checks if an sd card is installed. True if there is one, false if there isn't.
**Prototype**
```cpp
const bool IS_SD_CARD = pros::usd::is_installed();
const bool SD_CARD_ACTIVE = pros::usd::is_installed();
```

**Example**
```cpp
void initialize() {
if (!ez::util::IS_SD_CARD)
if (!ez::util::SD_CARD_ACTIVE)
printf("No SD Card Found!\n");
}
```
Expand Down
2 changes: 1 addition & 1 deletion include/EZ-Template/util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ double clamp_number(double input, double max, double min);
/**
* Is the SD card plugged in?
*/
const bool IS_SD_CARD = pros::usd::is_installed();
const bool SD_CARD_ACTIVE = pros::usd::is_installed();

/**
* Delay time for tasks
Expand Down
6 changes: 3 additions & 3 deletions src/EZ-Template/drive/user_input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ void Drive::set_curve_default(double left, double right) {
// Initialize curve SD card
void Drive::init_curve_sd() {
// If no SD card, return
if (!ez::util::IS_SD_CARD) return;
if (!ez::util::SD_CARD_ACTIVE) return;

FILE* l_usd_file_read;
// If file exists...
Expand Down Expand Up @@ -52,7 +52,7 @@ void Drive::init_curve_sd() {
// Save new left curve to SD card
void Drive::save_l_curve_sd() {
// If no SD card, return
if (!ez::util::IS_SD_CARD) return;
if (!ez::util::SD_CARD_ACTIVE) return;

FILE* usd_file_write = fopen("/usd/left_curve.txt", "w");
std::string in_str = std::to_string(left_curve_scale);
Expand All @@ -64,7 +64,7 @@ void Drive::save_l_curve_sd() {
// Save new right curve to SD card
void Drive::save_r_curve_sd() {
// If no SD card, return
if (!ez::util::IS_SD_CARD) return;
if (!ez::util::SD_CARD_ACTIVE) return;

FILE* usd_file_write = fopen("/usd/right_curve.txt", "w");
std::string in_str = std::to_string(right_curve_scale);
Expand Down
4 changes: 2 additions & 2 deletions src/EZ-Template/sdcard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ AutonSelector auton_selector{};

void update_auto_sd() {
// If no SD card, return
if (!ez::util::IS_SD_CARD) return;
if (!ez::util::SD_CARD_ACTIVE) return;

FILE* usd_file_write = fopen("/usd/auto.txt", "w");
std::string cp_str = std::to_string(auton_selector.current_auton_page);
Expand All @@ -24,7 +24,7 @@ void update_auto_sd() {

void init_auton_selector() {
// If no SD card, return
if (!ez::util::IS_SD_CARD) return;
if (!ez::util::SD_CARD_ACTIVE) return;

FILE* as_usd_file_read;
// If file exists...
Expand Down

0 comments on commit 7f2dfe4

Please sign in to comment.