C++ Library for the PsiSwarm Robot - Version 0.8

Dependents:   PsiSwarm_V8_Blank_CPP Autonomia_RndmWlk

Fork of PsiSwarmV7_CPP by Psi Swarm Robot

Committer:
jah128
Date:
Sun Oct 16 14:12:49 2016 +0000
Revision:
9:dde9e21030eb
Parent:
8:6c92789d5f87
Child:
10:e58323951c08
Added LED class

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jah128 0:d6269d17c8cf 1 /* University of York Robotics Laboratory PsiSwarm Library: PsiSwarm Core Source File
jah128 6:b340a527add9 2 *
jah128 6:b340a527add9 3 * Copyright 2016 University of York
jah128 6:b340a527add9 4 *
jah128 6:b340a527add9 5 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
jah128 6:b340a527add9 6 * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
jah128 6:b340a527add9 7 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS
jah128 6:b340a527add9 8 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
jah128 6:b340a527add9 9 * See the License for the specific language governing permissions and limitations under the License.
jah128 1:060690a934a9 10 *
jah128 0:d6269d17c8cf 11 * File: psiswarm.cpp
jah128 0:d6269d17c8cf 12 *
jah128 0:d6269d17c8cf 13 * (C) Dept. Electronics & Computer Science, University of York
jah128 0:d6269d17c8cf 14 * James Hilder, Alan Millard, Alexander Horsfield, Homero Elizondo, Jon Timmis
jah128 0:d6269d17c8cf 15 *
jah128 5:3cdd1a37cdd7 16 * PsiSwarm Library Version: 0.7
jah128 0:d6269d17c8cf 17 *
jah128 5:3cdd1a37cdd7 18 * October 2016
jah128 0:d6269d17c8cf 19 *
jah128 0:d6269d17c8cf 20 *
jah128 1:060690a934a9 21 */
jah128 0:d6269d17c8cf 22
jah128 0:d6269d17c8cf 23 #include "psiswarm.h"
jah128 0:d6269d17c8cf 24
jah128 8:6c92789d5f87 25 //Setup class instances
jah128 8:6c92789d5f87 26 Display display; //Connects to i2c(p28,p27), reset(p29), backlight(p30)
jah128 8:6c92789d5f87 27 Motors motors;
jah128 8:6c92789d5f87 28 Eprom eprom;
jah128 9:dde9e21030eb 29 Led led;
jah128 8:6c92789d5f87 30
jah128 0:d6269d17c8cf 31 //Setup MBED connections to PsiSwarm Robot
jah128 0:d6269d17c8cf 32 Serial pc(USBTX,USBRX);
jah128 0:d6269d17c8cf 33 I2C primary_i2c (p9, p10);
jah128 0:d6269d17c8cf 34 InterruptIn gpio_interrupt (p12);
jah128 0:d6269d17c8cf 35 Serial bt(p13, p14);
jah128 0:d6269d17c8cf 36 AnalogIn vin_current(p15);
jah128 0:d6269d17c8cf 37 AnalogIn vin_battery(p16);
jah128 0:d6269d17c8cf 38 AnalogIn vin_dc(p17);
jah128 0:d6269d17c8cf 39 PwmOut motor_left_f (p21);
jah128 0:d6269d17c8cf 40 PwmOut motor_left_r (p22);
jah128 0:d6269d17c8cf 41 PwmOut motor_right_f(p23);
jah128 0:d6269d17c8cf 42 PwmOut motor_right_r(p24);
jah128 0:d6269d17c8cf 43 PwmOut center_led_red(p25);
jah128 0:d6269d17c8cf 44 PwmOut center_led_green(p26);
jah128 0:d6269d17c8cf 45 DigitalOut mbed_led1(LED1);
jah128 0:d6269d17c8cf 46 DigitalOut mbed_led2(LED2);
jah128 0:d6269d17c8cf 47 DigitalOut mbed_led3(LED3);
jah128 0:d6269d17c8cf 48 DigitalOut mbed_led4(LED4);
jah128 0:d6269d17c8cf 49
jah128 0:d6269d17c8cf 50
jah128 0:d6269d17c8cf 51 float center_led_brightness;
jah128 0:d6269d17c8cf 52 float backlight_brightness;
jah128 0:d6269d17c8cf 53
jah128 0:d6269d17c8cf 54 Ticker event_handler;
jah128 0:d6269d17c8cf 55 Timer uptime;
jah128 0:d6269d17c8cf 56 Timeout pause_usercode_timeout;
jah128 0:d6269d17c8cf 57 Ticker ultrasonic_ticker;
jah128 0:d6269d17c8cf 58 Timeout ultrasonic_timeout;
jah128 0:d6269d17c8cf 59 int timer_minute_count;
jah128 0:d6269d17c8cf 60 Ticker timer_ticker;
jah128 0:d6269d17c8cf 61
jah128 0:d6269d17c8cf 62 float firmware_version;
jah128 1:060690a934a9 63 float pcb_version;
jah128 1:060690a934a9 64 float serial_number;
jah128 1:060690a934a9 65
jah128 1:060690a934a9 66 char has_compass=0;
jah128 1:060690a934a9 67 char has_side_ir=1;
jah128 1:060690a934a9 68 char has_base_ir=1;
jah128 1:060690a934a9 69 char has_base_colour_sensor=0;
jah128 1:060690a934a9 70 char has_top_colour_sensor=0;
jah128 1:060690a934a9 71 char has_wheel_encoders=0;
jah128 1:060690a934a9 72 char has_audio_pic=0;
jah128 1:060690a934a9 73 char has_ultrasonic_sensor=0;
jah128 1:060690a934a9 74 char has_temperature_sensor=0;
jah128 1:060690a934a9 75 char has_recharging_circuit=0;
jah128 1:060690a934a9 76 char has_433_radio=0;
jah128 1:060690a934a9 77
jah128 0:d6269d17c8cf 78 char robot_id;
jah128 0:d6269d17c8cf 79 char previous_robot_id;
jah128 0:d6269d17c8cf 80
jah128 0:d6269d17c8cf 81 char wheel_encoder_byte;
jah128 0:d6269d17c8cf 82 char previous_wheel_encoder_byte;
jah128 0:d6269d17c8cf 83 signed int left_encoder;
jah128 0:d6269d17c8cf 84 signed int right_encoder;
jah128 0:d6269d17c8cf 85
jah128 0:d6269d17c8cf 86 char time_based_motor_action = 0;
jah128 0:d6269d17c8cf 87
jah128 0:d6269d17c8cf 88 char testing_voltage_regulators_flag = 1;
jah128 0:d6269d17c8cf 89 char power_good_motor_left = 2;
jah128 0:d6269d17c8cf 90 char power_good_motor_right = 2;
jah128 0:d6269d17c8cf 91 char power_good_infrared = 2;
jah128 0:d6269d17c8cf 92 char status_dc_in = 2;
jah128 0:d6269d17c8cf 93 char status_charging = 2;
jah128 0:d6269d17c8cf 94
jah128 0:d6269d17c8cf 95 char switch_byte;
jah128 0:d6269d17c8cf 96 char previous_switch_byte;
jah128 0:d6269d17c8cf 97
jah128 4:1c621cb8cf0d 98
jah128 4:1c621cb8cf0d 99 char use_motor_calibration = USE_MOTOR_CALIBRATION;
jah128 4:1c621cb8cf0d 100 char motor_calibration_set;
jah128 4:1c621cb8cf0d 101 float left_motor_calibration_value = 1.0;
jah128 4:1c621cb8cf0d 102 float right_motor_calibration_value = 1.0;
jah128 4:1c621cb8cf0d 103
jah128 0:d6269d17c8cf 104 char debug_mode = DEBUG_MODE;
jah128 0:d6269d17c8cf 105 char debug_output = DEBUG_OUTPUT_STREAM;
jah128 1:060690a934a9 106
jah128 0:d6269d17c8cf 107 char firmware_bytes[21];
jah128 0:d6269d17c8cf 108
jah128 0:d6269d17c8cf 109 int base_colour_sensor_raw_values [4];
jah128 0:d6269d17c8cf 110 int top_colour_sensor_raw_values [4];
jah128 0:d6269d17c8cf 111
jah128 0:d6269d17c8cf 112 char waiting_for_ultrasonic = 0;
jah128 0:d6269d17c8cf 113 int ultrasonic_distance = 0;
jah128 0:d6269d17c8cf 114 char ultrasonic_distance_updated = 0;
jah128 0:d6269d17c8cf 115
jah128 0:d6269d17c8cf 116
jah128 0:d6269d17c8cf 117 float line_position = 0;
jah128 0:d6269d17c8cf 118 char line_found = 0;
jah128 0:d6269d17c8cf 119
jah128 0:d6269d17c8cf 120 unsigned short background_ir_values [8];
jah128 0:d6269d17c8cf 121 unsigned short illuminated_ir_values [8];
jah128 0:d6269d17c8cf 122 float reflected_ir_distances [8];
jah128 0:d6269d17c8cf 123 char ir_values_stored = 0;
jah128 0:d6269d17c8cf 124 unsigned short background_base_ir_values [5];
jah128 0:d6269d17c8cf 125 unsigned short illuminated_base_ir_values [5];
jah128 0:d6269d17c8cf 126 char base_ir_values_stored = 0;
jah128 0:d6269d17c8cf 127
jah128 0:d6269d17c8cf 128 float motor_left_speed;
jah128 0:d6269d17c8cf 129 float motor_right_speed;
jah128 0:d6269d17c8cf 130 char motor_left_brake;
jah128 0:d6269d17c8cf 131 char motor_right_brake;
jah128 0:d6269d17c8cf 132
jah128 0:d6269d17c8cf 133 char demo_on = 0;
jah128 0:d6269d17c8cf 134 char event = 0;
jah128 0:d6269d17c8cf 135 char change_id_event = 0;
jah128 0:d6269d17c8cf 136 char encoder_event = 0;
jah128 0:d6269d17c8cf 137 char switch_event = 0;
jah128 0:d6269d17c8cf 138 char user_code_running = 0;
jah128 0:d6269d17c8cf 139 char user_code_restore_mode = 0;
jah128 0:d6269d17c8cf 140 char system_warnings = 0;
jah128 0:d6269d17c8cf 141
jah128 0:d6269d17c8cf 142
jah128 0:d6269d17c8cf 143 vector<string> basic_filenames; //filenames are stored in a vector string
jah128 0:d6269d17c8cf 144 char psi_basic_file_count = 0;
jah128 0:d6269d17c8cf 145 char use_flash_basic = 0;
jah128 0:d6269d17c8cf 146 char file_transfer_mode = 0;
jah128 0:d6269d17c8cf 147
jah128 0:d6269d17c8cf 148 int ir_pulse_delay = DEFAULT_IR_PULSE_DELAY;
jah128 0:d6269d17c8cf 149 int base_ir_pulse_delay = DEFAULT_BASE_IR_PULSE_DELAY;
jah128 0:d6269d17c8cf 150
jah128 0:d6269d17c8cf 151
jah128 1:060690a934a9 152
jah128 1:060690a934a9 153
jah128 0:d6269d17c8cf 154 /**
jah128 0:d6269d17c8cf 155 * init()
jah128 0:d6269d17c8cf 156 *
jah128 0:d6269d17c8cf 157 * Main initialisation routine for the PsiSwarm robot
jah128 0:d6269d17c8cf 158 *
jah128 0:d6269d17c8cf 159 * Set up the GPIO expansion ICs, launch demo mode if button is held
jah128 0:d6269d17c8cf 160 */
jah128 0:d6269d17c8cf 161 void init()
jah128 0:d6269d17c8cf 162 {
jah128 0:d6269d17c8cf 163 firmware_version=0;
jah128 0:d6269d17c8cf 164 timer_minute_count = 0;
jah128 0:d6269d17c8cf 165 timer_ticker.attach(&IF_update_minutes, 300);
jah128 0:d6269d17c8cf 166 uptime.start();
jah128 0:d6269d17c8cf 167 primary_i2c.frequency(400000);
jah128 0:d6269d17c8cf 168 IF_setup_serial_interfaces();
jah128 0:d6269d17c8cf 169 debug("PsiSwarm Robot Library %1.2f\n\n",SOFTWARE_VERSION_CODE);
jah128 0:d6269d17c8cf 170 debug("- Setting up serial interface\n");
jah128 0:d6269d17c8cf 171 debug("- Reading firmware: ");
jah128 8:6c92789d5f87 172 if(eprom.read_firmware() == 1) {
jah128 1:060690a934a9 173 debug("Version %3.2f\n",firmware_version);
jah128 1:060690a934a9 174 IF_get_hardware_description();
jah128 4:1c621cb8cf0d 175 if(use_motor_calibration){
jah128 4:1c621cb8cf0d 176 if(!motor_calibration_set){
jah128 4:1c621cb8cf0d 177 if(firmware_version < 1.1){
jah128 4:1c621cb8cf0d 178 debug("- WARNING: This firmware is incompatible with motor calibration");
jah128 4:1c621cb8cf0d 179 debug("- WARNING: Please update the firmware to use this feature.");
jah128 4:1c621cb8cf0d 180 use_motor_calibration = 0;
jah128 4:1c621cb8cf0d 181 }
jah128 4:1c621cb8cf0d 182 else {
jah128 4:1c621cb8cf0d 183 debug("- WARNING: Motor calibration values have not been stored in firmware");
jah128 4:1c621cb8cf0d 184 debug("- WARNING: Run calibration routine to use this feature.");
jah128 4:1c621cb8cf0d 185 use_motor_calibration = 0;
jah128 4:1c621cb8cf0d 186 }
jah128 4:1c621cb8cf0d 187 }
jah128 4:1c621cb8cf0d 188 else {
jah128 4:1c621cb8cf0d 189 debug("- Motor calibration in use [LEFT:%0.4f RIGHT:%0.4f]",left_motor_calibration_value,right_motor_calibration_value);
jah128 4:1c621cb8cf0d 190 }
jah128 4:1c621cb8cf0d 191 }
jah128 1:060690a934a9 192 } else {
jah128 1:060690a934a9 193 debug("INVALID\n");
jah128 1:060690a934a9 194 debug("- WARNING: Check firmware to enable robot features");
jah128 1:060690a934a9 195 }
jah128 1:060690a934a9 196 if(ENABLE_BASIC == 1) {
jah128 1:060690a934a9 197 read_list_of_file_names();
jah128 1:060690a934a9 198 if(psi_basic_file_count == 0) {
jah128 1:060690a934a9 199 debug("- No PsiBasic files found\n");
jah128 1:060690a934a9 200 } else use_flash_basic = 1;
jah128 0:d6269d17c8cf 201 }
jah128 0:d6269d17c8cf 202 debug("- Setting up PIC microcontroller\n");
jah128 0:d6269d17c8cf 203 // IF_check_pic_firmware();
jah128 0:d6269d17c8cf 204 debug("- Setting up LED drivers\n");
jah128 9:dde9e21030eb 205 led.IF_init_leds();
jah128 0:d6269d17c8cf 206 if(IF_setup_led_expansion_ic() != 0) {
jah128 1:060690a934a9 207 debug("- WARNING: No I2C acknowledge for LED driver\n");
jah128 1:060690a934a9 208 system_warnings += 1;
jah128 0:d6269d17c8cf 209 }
jah128 0:d6269d17c8cf 210 debug("- Setting up motor drivers\n");
jah128 8:6c92789d5f87 211 motors.init_motors();
jah128 0:d6269d17c8cf 212 debug("- Setting up GPIO expansion\n");
jah128 0:d6269d17c8cf 213 reset_encoders();
jah128 0:d6269d17c8cf 214 IF_setup_gpio_expansion_ic();
jah128 1:060690a934a9 215 if(has_temperature_sensor) {
jah128 1:060690a934a9 216 debug("- Setting up temperature sensor\n");
jah128 1:060690a934a9 217 IF_setup_temperature_sensor();
jah128 1:060690a934a9 218 }
jah128 1:060690a934a9 219 if(has_base_colour_sensor) {
jah128 1:060690a934a9 220 debug("- Setting up base colour sensor\n");
jah128 1:060690a934a9 221 IF_check_base_colour_sensor();
jah128 1:060690a934a9 222 }
jah128 1:060690a934a9 223 if(has_ultrasonic_sensor) {
jah128 1:060690a934a9 224 debug("- Setting up ultrasonic sensor\n");
jah128 1:060690a934a9 225 //enable_ultrasonic_ticker();
jah128 1:060690a934a9 226 }
jah128 1:060690a934a9 227
jah128 0:d6269d17c8cf 228 debug("- Robot ID: %d\n",robot_id);
jah128 1:060690a934a9 229 char switchstate = IF_get_switch_state();
jah128 0:d6269d17c8cf 230 debug("- Switch State : %d\n",switchstate);
jah128 0:d6269d17c8cf 231 debug("- Battery Voltage: %1.3fV\n",get_battery_voltage());
jah128 0:d6269d17c8cf 232 debug("- DC Voltage : %1.3fV\n",get_dc_voltage());
jah128 0:d6269d17c8cf 233 debug("- Current Draw : %1.3fA\n",get_current());
jah128 1:060690a934a9 234 if(has_temperature_sensor){
jah128 0:d6269d17c8cf 235 debug("- Temperature : %1.3fC\n",get_temperature());
jah128 1:060690a934a9 236 }
jah128 0:d6269d17c8cf 237 char demo = 0;
jah128 0:d6269d17c8cf 238 if(ENABLE_DEMO == 1 && switchstate > 0) demo=1;
jah128 0:d6269d17c8cf 239 display.init_display(demo);
jah128 0:d6269d17c8cf 240 event_handler.attach_us(&IF_handle_events, 1000);
jah128 1:060690a934a9 241 if(demo > 0) {
jah128 0:d6269d17c8cf 242 debug("- Demo mode button is pressed\n");
jah128 0:d6269d17c8cf 243 wait(1.0);
jah128 0:d6269d17c8cf 244 demo = IF_get_switch_state();
jah128 0:d6269d17c8cf 245 if(demo > 0) demo_mode();
jah128 1:060690a934a9 246 display.init_display(0);
jah128 0:d6269d17c8cf 247 }
jah128 0:d6269d17c8cf 248 }
jah128 0:d6269d17c8cf 249
jah128 1:060690a934a9 250 void IF_update_minutes()
jah128 1:060690a934a9 251 {
jah128 0:d6269d17c8cf 252 uptime.reset();
jah128 0:d6269d17c8cf 253 timer_minute_count += 5;
jah128 0:d6269d17c8cf 254 }
jah128 0:d6269d17c8cf 255
jah128 0:d6269d17c8cf 256 void IF_handle_events()
jah128 0:d6269d17c8cf 257 {
jah128 0:d6269d17c8cf 258 // This is the main 'operating system' thread that handles events from robot stimuli
jah128 0:d6269d17c8cf 259 // By default it is run every 1ms and checks if there are events to handle
jah128 1:060690a934a9 260 if(event > 0) {
jah128 0:d6269d17c8cf 261 // There are some events to handle. We don't handle all events in every loop to keep the system responsive, instead they are priorised.
jah128 1:060690a934a9 262 if(encoder_event == 1) {
jah128 0:d6269d17c8cf 263 // The encoders have changed; update the encoder values
jah128 0:d6269d17c8cf 264 IF_update_encoders();
jah128 1:060690a934a9 265 encoder_event = 0;
jah128 1:060690a934a9 266 event--;
jah128 0:d6269d17c8cf 267 } else {
jah128 1:060690a934a9 268 if(switch_event == 1) {
jah128 1:060690a934a9 269 IF_update_switch();
jah128 1:060690a934a9 270 switch_event = 0;
jah128 1:060690a934a9 271 event--;
jah128 0:d6269d17c8cf 272 }
jah128 1:060690a934a9 273 if(change_id_event == 1) {
jah128 0:d6269d17c8cf 274 // The user ID for the robot has been changed
jah128 0:d6269d17c8cf 275 IF_update_user_id();
jah128 0:d6269d17c8cf 276 change_id_event = 0;
jah128 0:d6269d17c8cf 277 event--;
jah128 0:d6269d17c8cf 278 }
jah128 0:d6269d17c8cf 279 }
jah128 1:060690a934a9 280 }
jah128 0:d6269d17c8cf 281 }
jah128 0:d6269d17c8cf 282
jah128 0:d6269d17c8cf 283 void IF_update_encoders()
jah128 0:d6269d17c8cf 284 {
jah128 0:d6269d17c8cf 285 char rwep = previous_wheel_encoder_byte >> 2;
jah128 0:d6269d17c8cf 286 char rwe = wheel_encoder_byte >> 2;
jah128 0:d6269d17c8cf 287 char lwep = previous_wheel_encoder_byte % 4;
jah128 0:d6269d17c8cf 288 char lwe = wheel_encoder_byte % 4;
jah128 0:d6269d17c8cf 289 //pc.printf("L:%d P:%d R:%d P:%d \n",lwe,lwep,rwe,rwep);
jah128 0:d6269d17c8cf 290 if(lwe == 0 && lwep==1) left_encoder++;
jah128 0:d6269d17c8cf 291 if(lwe == 0 && lwep==2) left_encoder--;
jah128 0:d6269d17c8cf 292 if(rwe == 0 && rwep==1) right_encoder++;
jah128 0:d6269d17c8cf 293 if(rwe == 0 && rwep==2) right_encoder--;
jah128 0:d6269d17c8cf 294 if(left_encoder % 100 == 0) pc.printf("L:%d\n",left_encoder);
jah128 0:d6269d17c8cf 295 }
jah128 0:d6269d17c8cf 296
jah128 0:d6269d17c8cf 297 void IF_update_user_id()
jah128 0:d6269d17c8cf 298 {
jah128 0:d6269d17c8cf 299 }
jah128 0:d6269d17c8cf 300
jah128 0:d6269d17c8cf 301 void IF_update_switch()
jah128 0:d6269d17c8cf 302 {
jah128 0:d6269d17c8cf 303 // The user switch has changed state
jah128 0:d6269d17c8cf 304 // In this implementation we will only act on positive changes (rising edges)
jah128 0:d6269d17c8cf 305 // Subtracting new_state from (new_state & old_state) gives the positive changes
jah128 0:d6269d17c8cf 306 char positive_change = switch_byte - (switch_byte & previous_switch_byte);
jah128 0:d6269d17c8cf 307 if(demo_on) demo_handle_switch_event(positive_change);
jah128 0:d6269d17c8cf 308 else handle_switch_event(positive_change);
jah128 0:d6269d17c8cf 309 }
jah128 0:d6269d17c8cf 310
jah128 0:d6269d17c8cf 311 void reset_encoders()
jah128 0:d6269d17c8cf 312 {
jah128 0:d6269d17c8cf 313 left_encoder = 0;
jah128 1:060690a934a9 314 right_encoder = 0;
jah128 0:d6269d17c8cf 315 }
jah128 0:d6269d17c8cf 316
jah128 1:060690a934a9 317 void debug(const char* format, ...)
jah128 0:d6269d17c8cf 318 {
jah128 1:060690a934a9 319 char buffer[256];
jah128 1:060690a934a9 320 if (debug_mode) {
jah128 1:060690a934a9 321 va_list vl;
jah128 1:060690a934a9 322 va_start(vl, format);
jah128 1:060690a934a9 323 vsprintf(buffer,format,vl);
jah128 1:060690a934a9 324 if(debug_output & 2) bt.printf("%s", buffer);
jah128 1:060690a934a9 325 if(debug_output & 1) pc.printf("%s", buffer);
jah128 1:060690a934a9 326 if(debug_output & 4) display.debug_page(buffer,strlen(buffer));
jah128 1:060690a934a9 327 va_end(vl);
jah128 1:060690a934a9 328 }
jah128 0:d6269d17c8cf 329 }
jah128 0:d6269d17c8cf 330
jah128 0:d6269d17c8cf 331 float get_uptime(void)
jah128 0:d6269d17c8cf 332 {
jah128 1:060690a934a9 333 return uptime.read() + (timer_minute_count * 60);
jah128 0:d6269d17c8cf 334 }
jah128 0:d6269d17c8cf 335
jah128 1:060690a934a9 336 void pause_user_code(float period)
jah128 1:060690a934a9 337 {
jah128 0:d6269d17c8cf 338 user_code_restore_mode = user_code_running;
jah128 0:d6269d17c8cf 339 user_code_running = 0;
jah128 0:d6269d17c8cf 340 pause_usercode_timeout.attach(&IF_end_pause_user_code, period);
jah128 0:d6269d17c8cf 341 }
jah128 0:d6269d17c8cf 342
jah128 1:060690a934a9 343 void IF_end_pause_user_code()
jah128 1:060690a934a9 344 {
jah128 1:060690a934a9 345 user_code_running = user_code_restore_mode;
jah128 1:060690a934a9 346 }
jah128 1:060690a934a9 347
jah128 1:060690a934a9 348 void IF_get_hardware_description()
jah128 1:060690a934a9 349 {
jah128 1:060690a934a9 350 debug("- Robot serial number %1.2f\n",serial_number);
jah128 1:060690a934a9 351 debug("- PCB version %1.2f\n",pcb_version);
jah128 1:060690a934a9 352 debug("- Hardware: ");
jah128 1:060690a934a9 353 if(has_compass) debug("COMPASS, ");
jah128 1:060690a934a9 354 if(has_side_ir) debug("SIDE IR, ");
jah128 1:060690a934a9 355 if(has_base_ir) debug("BASE IR, ");
jah128 1:060690a934a9 356 if(has_base_colour_sensor) debug("BASE COLOUR, ");
jah128 1:060690a934a9 357 if(has_top_colour_sensor) debug("TOP COLOUR, ");
jah128 1:060690a934a9 358 if(has_wheel_encoders) debug("WHEEL ENC., ");
jah128 1:060690a934a9 359 if(has_audio_pic) debug("AUDIO, ");
jah128 1:060690a934a9 360 if(has_ultrasonic_sensor) debug("ULTRASONIC, ");
jah128 1:060690a934a9 361 if(has_temperature_sensor) debug("TEMPERATURE, ");
jah128 1:060690a934a9 362 if(has_recharging_circuit) debug("RECHARGING, ");
jah128 1:060690a934a9 363 if(has_433_radio) debug("433 RADIO.");
jah128 1:060690a934a9 364 debug("\n");
jah128 0:d6269d17c8cf 365 }