Skip to content

Commit

Permalink
SD card: fix insertion/removal detection
Browse files Browse the repository at this point in the history
  • Loading branch information
dexterbg committed Apr 14, 2018
1 parent 90cd557 commit 7aa91ac
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion vehicle/OVMS.V3/components/sdcard/src/sdcard.cpp
Expand Up @@ -97,6 +97,7 @@ sdcard::sdcard(const char* name, bool mode1bit, bool autoformat, int cdpin)

m_mounted = false;
m_cd = false;
m_cdpin = cdpin;
insertcount = 5;

// Register our events
Expand Down Expand Up @@ -159,7 +160,7 @@ bool sdcard::isinserted()

void sdcard::CheckCardState()
{
bool cd = (gpio_get_level((gpio_num_t)m_slot.gpio_cd)==0)?true:false;
bool cd = (gpio_get_level((gpio_num_t)m_cdpin)==0)?true:false;

if (cd != m_cd)
{
Expand Down
1 change: 1 addition & 0 deletions vehicle/OVMS.V3/components/sdcard/src/sdcard.h
Expand Up @@ -63,6 +63,7 @@ class sdcard : public pcp
sdmmc_card_t* m_card;
bool m_mounted;
bool m_cd;
int m_cdpin;
};

#endif //#ifndef __SDCARD_H__

0 comments on commit 7aa91ac

Please sign in to comment.