#631 TIME_MS2I mostly
This commit is contained in:
parent
c6ef295002
commit
d9c8c1fc3e
|
@ -32,8 +32,8 @@
|
|||
#define DFU_ACK_BYTE 0x79 // Acknowledge byte ID
|
||||
#define DFU_NACK_BYTE 0x1F // Not-Acknowledge byte ID
|
||||
|
||||
#define DFU_SR5_TIMEOUT_FIRST MS2ST(200)
|
||||
#define DFU_SR5_TIMEOUT_NORMAL MS2ST(1000)
|
||||
#define DFU_SR5_TIMEOUT_FIRST TIME_MS2I(200)
|
||||
#define DFU_SR5_TIMEOUT_NORMAL TIME_MS2I(1000)
|
||||
|
||||
#define MCU_REVISION_MASK 0xfff // MCU Revision ID is needed by DFU protocol
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ static char cmdPin[16];
|
|||
|
||||
static const int baudRates[] = { 0, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, -1 };
|
||||
static const int baudRateIndexList[] = { 4 /*9600*/, 6 /*38400*/, 8 /*115200*/, 7, 5, 3, 2, 1, -1 };
|
||||
static const int btModuleTimeout = MS2ST(1000);
|
||||
static const int btModuleTimeout = TIME_MS2I(1000);
|
||||
|
||||
static ts_channel_s *tsChannel;
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
// The Bluetooth setup procedure will wait 10 seconds for the user to disconnect the UART cable.
|
||||
// This is required because the BT setup procedure reads a response from the module during the communication.
|
||||
// Thus any bytes sent from the Console Software may interfere with the procedure.
|
||||
#define BLUETOOTH_COMMAND_TIMEOUT MS2ST(10000)
|
||||
#define BLUETOOTH_COMMAND_TIMEOUT TIME_MS2I(10000)
|
||||
|
||||
// Supported Bluetooth module types
|
||||
typedef enum {
|
||||
|
|
|
@ -90,10 +90,10 @@ void startTsPort(ts_channel_s *tsChannel);
|
|||
bool stopTsPort(ts_channel_s *tsChannel);
|
||||
|
||||
// that's 1 second
|
||||
#define BINARY_IO_TIMEOUT MS2ST(1000)
|
||||
#define BINARY_IO_TIMEOUT TIME_MS2I(1000)
|
||||
|
||||
// that's 1 second
|
||||
#define SR5_READ_TIMEOUT MS2ST(1000)
|
||||
#define SR5_READ_TIMEOUT TIME_MS2I(1000)
|
||||
|
||||
void sr5WriteData(ts_channel_s *tsChannel, const uint8_t * buffer, int size);
|
||||
void sr5WriteCrcPacket(ts_channel_s *tsChannel, const uint8_t responseCode, const void *buf, const uint16_t size);
|
||||
|
|
|
@ -222,7 +222,7 @@ static void scheduleNextSlowInvocation(void) {
|
|||
int periodMs = CONFIGB(generalPeriodicThreadPeriod);
|
||||
if (periodMs == 0)
|
||||
periodMs = 50; // this might happen while resetting configuration
|
||||
chVTSetAny(&periodicSlowTimer, MS2ST(periodMs), (vtfunc_t) &periodicSlowCallback, engine);
|
||||
chVTSetAny(&periodicSlowTimer, TIME_MS2I(periodMs), (vtfunc_t) &periodicSlowCallback, engine);
|
||||
}
|
||||
|
||||
static void periodicFastCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||
|
@ -231,7 +231,7 @@ static void periodicFastCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
* not many reasons why we use ChibiOS timer and not say a dedicated thread here
|
||||
* the only down-side of a dedicated thread is the cost of thread stack
|
||||
*/
|
||||
chVTSetAny(&periodicFastTimer, MS2ST(20), (vtfunc_t) &periodicFastCallback, engine);
|
||||
chVTSetAny(&periodicFastTimer, TIME_MS2I(20), (vtfunc_t) &periodicFastCallback, engine);
|
||||
}
|
||||
|
||||
static void resetAccel(void) {
|
||||
|
|
|
@ -81,9 +81,9 @@ static void setInjectorEnabled(int id, int value) {
|
|||
|
||||
static void runBench(brain_pin_e brainPin, OutputPin *output, float delayMs, float onTimeMs, float offTimeMs,
|
||||
int count) {
|
||||
int delaySt = delayMs < 1 ? 1 : MS2ST(delayMs);
|
||||
int onTimeSt = onTimeMs < 1 ? 1 : MS2ST(onTimeMs);
|
||||
int offTimeSt = offTimeMs < 1 ? 1 : MS2ST(offTimeMs);
|
||||
int delaySt = delayMs < 1 ? 1 : TIME_MS2I(delayMs);
|
||||
int onTimeSt = onTimeMs < 1 ? 1 : TIME_MS2I(onTimeMs);
|
||||
int offTimeSt = offTimeMs < 1 ? 1 : TIME_MS2I(offTimeMs);
|
||||
if (delaySt < 0) {
|
||||
scheduleMsg(logger, "Invalid delay %.2f", delayMs);
|
||||
return;
|
||||
|
|
|
@ -206,7 +206,7 @@ void test_cpu_pulse(unsigned duration) {
|
|||
systime_t start, end, now;
|
||||
|
||||
start = chThdSelf()->p_time;
|
||||
end = start + MS2ST(duration);
|
||||
end = start + TIME_MS2I(duration);
|
||||
do {
|
||||
now = chThdSelf()->p_time;
|
||||
#if defined(SIMULATOR)
|
||||
|
@ -252,7 +252,7 @@ static void tmr(void *p) {
|
|||
*/
|
||||
void test_start_timer(unsigned ms) {
|
||||
|
||||
systime_t duration = MS2ST(ms);
|
||||
systime_t duration = TIME_MS2I(ms);
|
||||
test_timer_done = FALSE;
|
||||
chVTSet(&vt, duration, tmr, NULL);
|
||||
}
|
||||
|
|
|
@ -246,7 +246,7 @@
|
|||
|
||||
|
||||
#define FF_FS_REENTRANT 0
|
||||
#define FF_FS_TIMEOUT MS2ST(1000)
|
||||
#define FF_FS_TIMEOUT TIME_MS2I(1000)
|
||||
#define FF_SYNC_t semaphore_t*
|
||||
/* The option FF_FS_REENTRANT switches the re-entrancy (thread safe) of the FatFs
|
||||
/ module itself. Note that regardless of this option, file access to different
|
||||
|
|
|
@ -135,5 +135,8 @@ void unlockAnyContext(void);
|
|||
}
|
||||
#endif
|
||||
|
||||
// a step towards ChibiOS18
|
||||
#define TIME_MS2I(x) MS2ST(x)
|
||||
|
||||
#endif /* GLOBAL_H_ */
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ static void sendCanMessage2(int size) {
|
|||
}
|
||||
txmsg.DLC = size;
|
||||
// 1 second timeout
|
||||
msg_t result = canTransmit(device, CAN_ANY_MAILBOX, &txmsg, MS2ST(1000));
|
||||
msg_t result = canTransmit(device, CAN_ANY_MAILBOX, &txmsg, TIME_MS2I(1000));
|
||||
if (result == MSG_OK) {
|
||||
canWriteOk++;
|
||||
} else {
|
||||
|
@ -234,7 +234,7 @@ static void canRead(void) {
|
|||
return;
|
||||
}
|
||||
// scheduleMsg(&logger, "Waiting for CAN");
|
||||
msg_t result = canReceive(device, CAN_ANY_MAILBOX, &rxBuffer, MS2ST(1000));
|
||||
msg_t result = canReceive(device, CAN_ANY_MAILBOX, &rxBuffer, TIME_MS2I(1000));
|
||||
if (result == MSG_TIMEOUT) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -156,7 +156,7 @@ static void rebootNow(void) {
|
|||
static void scheduleReboot(void) {
|
||||
scheduleMsg(&sharedLogger, "Rebooting in 5 seconds...");
|
||||
lockAnyContext();
|
||||
chVTSetI(&resetTimer, MS2ST(5000), (vtfunc_t) rebootNow, NULL);
|
||||
chVTSetI(&resetTimer, TIME_MS2I(5000), (vtfunc_t) rebootNow, NULL);
|
||||
unlockAnyContext();
|
||||
}
|
||||
|
||||
|
|
|
@ -93,6 +93,9 @@ void applyNewConfiguration(void);
|
|||
|
||||
#define hal_lld_get_counter_value() 0
|
||||
|
||||
// a step towards ChibiOS18
|
||||
#define TIME_MS2I(x) MS2ST(x)
|
||||
|
||||
#endif /* GLOBAL_H_ */
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue