diff --git a/Telem_Debug/Debug2/SunseekerTelemetry2021.h b/Telem_Debug/Debug2/SunseekerTelemetry2021.h index 5fdfa31..076d095 100644 --- a/Telem_Debug/Debug2/SunseekerTelemetry2021.h +++ b/Telem_Debug/Debug2/SunseekerTelemetry2021.h @@ -30,11 +30,12 @@ static inline void delay(void) { volatile int jj; volatile int ii; - for (ii = 0; ii < 4; ii++) + // Using count-down since it uses one less instruction to compare (not really necessary here, but CCS recommends it anyway): Ultra-Low Power Advisor > Rule 13.1 (https://software-dl.ti.com/ccs/esd/documents/dmed/HTML/MSP430/1544.html) + for (ii = 4; ii > 0; ii--) { - for (jj = 0; jj < 1000; jj++) + for (jj = 1000; jj > 0; jj--) { - asm(" nop"); //The space is necessary or else the assember things nop is a label! + asm(" nop"); //The space is necessary or else the assembler thinks "nop" is a label! } } } diff --git a/Telem_Debug/Debug3/SunseekerTelemetry2021.h b/Telem_Debug/Debug3/SunseekerTelemetry2021.h index 9c272b1..71c8f07 100644 --- a/Telem_Debug/Debug3/SunseekerTelemetry2021.h +++ b/Telem_Debug/Debug3/SunseekerTelemetry2021.h @@ -29,9 +29,10 @@ static inline void delay(void) { volatile int jj; volatile int ii; - for (ii = 0; ii < 4; ii++) + // Using count-down since it uses one less instruction to compare (not really necessary here, but CCS recommends it anyway): Ultra-Low Power Advisor > Rule 13.1 (https://software-dl.ti.com/ccs/esd/documents/dmed/HTML/MSP430/1544.html) + for (ii = 4; ii > 0; ii--) { - for (jj = 0; jj < 1000; jj++) + for (jj = 1000; jj > 0; jj--) { asm(" nop"); //The space is necessary or else the assembler thinks "nop" is a label! } diff --git a/Telem_Debug/Debug_BlinkyLED/SunseekerTelemetry2021.h b/Telem_Debug/Debug_BlinkyLED/SunseekerTelemetry2021.h index 0fbe507..00f862f 100644 --- a/Telem_Debug/Debug_BlinkyLED/SunseekerTelemetry2021.h +++ b/Telem_Debug/Debug_BlinkyLED/SunseekerTelemetry2021.h @@ -28,9 +28,10 @@ static inline void delay(void) { volatile int jj; volatile int ii; - for (ii = 0; ii < 4; ii++) + // Using count-down since it uses one less instruction to compare (not really necessary here, but CCS recommends it anyway): Ultra-Low Power Advisor > Rule 13.1 (https://software-dl.ti.com/ccs/esd/documents/dmed/HTML/MSP430/1544.html) + for (ii = 4; ii > 0; ii--) { - for (jj = 0; jj < 1000; jj++) + for (jj = 1000; jj > 0; jj--) { asm(" nop"); //The space is necessary or else the assembler thinks "nop" is a label! } diff --git a/Telem_Debug/Debug_BlinkyLED/main.c b/Telem_Debug/Debug_BlinkyLED/main.c index 55432c4..1401c7c 100644 --- a/Telem_Debug/Debug_BlinkyLED/main.c +++ b/Telem_Debug/Debug_BlinkyLED/main.c @@ -1,47 +1,8 @@ -// -// Telemetry -// -// Modified by Erik in 2010-2011 -// -/* Modifications for 2013 by B. Bazuin - * - 2013v1 - * - reworked to operate continuously with CAN at 250 kbps - * - no USB device code included - * - no ADC code - * - table values collected only the first time captured - * - 2014V2 MODIFICATIONS - * - Reordered and eliminated some messages - * - HF rate 10 sec, LF rate 30 sec, ST rate 60 sec - * - BP_PCDONE and BP_ISH added - * - Precharge Controller Removed - */ -/* Modifications for 2016 by B. Bazuin - * -New BPS and Array Controller - * +/* + * main.c */ #include "SunseekerTelemetry2021.h" -y2021.h" - -// structures -//message_fifo decode_queue; -//char_fifo USB_FIFO, MODEM_FIFO; - -//hf_packet pckHF; -//lf_packet pckLF; -//status_packet pckST; - -unsigned volatile char forceread; - -unsigned int can_mask0, can_mask1; - -enum MODE {INIT, CANREAD, DECODE, MODEMTX, USBTX, LOWP, LOOP} ucMODE; -unsigned volatile char can_status_test, can_rcv_status_test; -unsigned long can_msg_count = 0, can_stall_cnt = 0; -unsigned long can_err_count = 0, can_read_cnt = 0; -int thrs, tmin, tsec; -char ucFLAG,usbENABLE; -char CAN1_INT_FLAG = FALSE;