start-up fix?
This commit is contained in:
parent
bfeb1343cf
commit
d5a85541df
|
@ -223,6 +223,8 @@ bool Pt2001::init() {
|
|||
|
||||
Pt2001 chip;
|
||||
|
||||
mfs_error_t flashStartState;
|
||||
|
||||
/*
|
||||
* Application entry point.
|
||||
*/
|
||||
|
@ -232,7 +234,7 @@ int main() {
|
|||
|
||||
// Fire up all of our threads
|
||||
InitPins();
|
||||
bool isFlashOk = InitFlash();
|
||||
flashStartState = InitFlash();
|
||||
InitCan();
|
||||
InitUart();
|
||||
|
||||
|
@ -242,10 +244,10 @@ int main() {
|
|||
palClearPad(LED_GREEN_PORT, LED_GREEN_PIN);
|
||||
|
||||
bool isOverallHappyStatus = false;
|
||||
if (isFlashOk) {
|
||||
|
||||
ReadOrDefault();
|
||||
// reminder that +12v is required for PT2001 to start
|
||||
isOverallHappyStatus = chip.init();
|
||||
}
|
||||
|
||||
while (true) {
|
||||
if (isOverallHappyStatus) {
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#include "hal.h"
|
||||
|
||||
#include "persistence.h"
|
||||
#include "hal_mfs.h"
|
||||
|
||||
#define MFS_RECORD_ID 1
|
||||
|
||||
|
@ -19,10 +18,13 @@ const MFSConfig mfscfg1 = {
|
|||
static MFSDriver mfs1;
|
||||
uint8_t mfs_buffer[512];
|
||||
|
||||
bool InitFlash() {
|
||||
/**
|
||||
* @return true if mfsStart is well
|
||||
*/
|
||||
mfs_error_t InitFlash() {
|
||||
mfsObjectInit(&mfs1);
|
||||
mfs_error_t err = mfsStart(&mfs1, &mfscfg1);
|
||||
return err == MFS_NO_ERROR;
|
||||
return err;
|
||||
}
|
||||
|
||||
extern GDIConfiguration configuration;
|
||||
|
|
|
@ -2,14 +2,14 @@
|
|||
* @file persistence.h
|
||||
*/
|
||||
|
||||
|
||||
#include "hal_mfs.h"
|
||||
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* @return true if OK, false if broken
|
||||
*/
|
||||
bool InitFlash();
|
||||
mfs_error_t InitFlash();
|
||||
void saveConfiguration();
|
||||
void ReadOrDefault();
|
||||
|
||||
|
|
Loading…
Reference in New Issue