Misc. improvements (#12747)

* Make ExtUI respect MAXTEMP limits
  - Temperatures are now clamped by MAXTEMP limits rather than arbitrary values.
* Speed up USB init, add status
  - Speed up USB initialization
  - Show status message if init failed
* Enable status messages for EXTENSIBLE_UI
* Adjust max limit to MAX_TEMP - 15
* Misc. tweaks to formatting, const, etc.
This commit is contained in:
Marcio Teixeira
2019-01-01 14:17:48 -07:00
committed by Scott Lahteine
parent 4f2473053c
commit 60cb36bef3
12 changed files with 188 additions and 209 deletions

View File

@ -32,7 +32,6 @@
*/
//#define USB_DEBUG 1
#include "../SdFatConfig.h"
#include "../SdInfo.h"
@ -61,11 +60,11 @@
class Sd2Card {
private:
typedef enum {
USB_HOST_DELAY_INIT,
USB_HOST_WAITING,
typedef enum : uint8_t {
USB_HOST_UNINITIALIZED,
USB_HOST_INITIALIZED
USB_HOST_INITIALIZED,
USB_HOST_DELAY_INIT,
USB_HOST_WAITING
} state_t;
static state_t state;
@ -75,21 +74,20 @@ class Sd2Card {
uint32_t lun0_capacity;
#endif
static inline bool ready() {return state == USB_HOST_INITIALIZED;}
static inline bool ready() { return state == USB_HOST_INITIALIZED; }
public:
bool init(uint8_t sckRateID = 0, uint8_t chipSelectPin = SD_CHIP_SELECT_PIN);
bool init(const uint8_t sckRateID=0, const pin_t chipSelectPin=SD_CHIP_SELECT_PIN);
static void idle();
bool readStart(uint32_t block) { pos = block; return ready(); }
bool readData(uint8_t* dst) { return readBlock(pos++, dst); }
bool readStop() { return true; }
bool writeStart(uint32_t block, uint32_t eraseCount) { pos = block; return ready(); }
bool writeData(uint8_t* src) { return writeBlock(pos++, src); }
bool writeStop() { return true; }
inline bool readStart(const uint32_t block) { pos = block; return ready(); }
inline bool readData(uint8_t* dst) { return readBlock(pos++, dst); }
inline bool readStop() const { return true; }
inline bool writeStart(const uint32_t block, const uint32_t eraseCount) { UNUSED(eraseCount); pos = block; return ready(); }
inline bool writeData(uint8_t* src) { return writeBlock(pos++, src); }
inline bool writeStop() const { return true; }
bool readBlock(uint32_t block, uint8_t* dst);
bool writeBlock(uint32_t blockNumber, const uint8_t* src);