6 pros::Task temp_screening([]() {
8 std::vector<double> left_temps =
leftMotors.get_temperature_all();
9 std::vector<double> right_temps =
rightMotors.get_temperature_all();
11 bool is_overheating =
false;
13 const double TEMP_LIMIT = 55.0;
14 for (
int i = 0; i < left_temps.size(); i++) {
15 if (left_temps[i] > TEMP_LIMIT) {
18 controller.print(0, 0,
"OVERHEAT! L%i", i + 1);
21 is_overheating =
true;
31 for (
int i = 0; i < right_temps.size(); i++) {
32 if (right_temps[i] > TEMP_LIMIT) {
35 controller.print(0, 0,
"OVERHEAT! R%i", i + 1);
38 is_overheating =
true;
42 if(pros::battery::get_temperature() >= 45)
46 controller.print(0, 0,
"Battery Overheat! %i", (
int)pros::battery::get_temperature());
49 is_overheating =
true;
62 pros::Task disconnect_screening([]() {
63 std::vector<pros::Motor> all_motors = pros::Motor::get_all_devices();
64 std::vector<unsigned char> disconnected;
65 std::vector<unsigned char> last_disconnected;
66 bool is_notified =
false;
67 uint32_t now = pros::millis();
69 constexpr int TASK_DELAY_MILLIS = 1000;
70 constexpr int CONTROLLER_DELAY_MILLIS = 50;
72 std::string disc_motors =
"MD: ";
73 bool are_motors_disconnected =
false;
75 for (pros::Motor i : all_motors) {
76 if (!i.is_installed()) {
77 unsigned char port = i.get_port();
78 disconnected.push_back(port);
79 disc_motors = disc_motors +
" " + std::to_string(port);
80 are_motors_disconnected =
true;
83 if (are_motors_disconnected) {
85 pros::delay(CONTROLLER_DELAY_MILLIS);
88 pros::delay(CONTROLLER_DELAY_MILLIS);
90 if (disconnected.size() > last_disconnected.size()) {
92 }
else if (disconnected.size() < last_disconnected.size()) {
94 }
else if (!are_motors_disconnected && is_notified) {
98 last_disconnected = disconnected;
107 pros::Task disconnect_screening([]() {
109 std::vector<unsigned char> disconnected;
110 std::vector<unsigned char> last_disconnected;
111 bool is_notified =
false;
113 constexpr int TASK_DELAY_MILLIS = 1000;
114 constexpr int CONTROLLER_DELAY_MILLIS = 50;
116 std::string disc_d_sensors =
"DSD: ";
117 bool are_distance_sensors_disconnected =
false;
119 for (pros::Distance i : all_distance_sensors) {
120 if (!i.is_installed()) {
121 unsigned char port = i.get_port();
122 disconnected.push_back(port);
123 disc_d_sensors = disc_d_sensors +
" " + std::to_string(port);
124 are_distance_sensors_disconnected =
true;
127 if (are_distance_sensors_disconnected) {
129 pros::delay(CONTROLLER_DELAY_MILLIS);
132 pros::delay(CONTROLLER_DELAY_MILLIS);
134 if (disconnected.size() > last_disconnected.size()) {
136 }
else if (disconnected.size() < last_disconnected.size()) {
138 }
else if (!are_distance_sensors_disconnected && is_notified) {
142 last_disconnected = disconnected;
143 disconnected.clear();