fix windows compat and some bugs

sipo
Ondřej Hruška 7 years ago
parent 56a935cdd0
commit 62096da6e6
  1. 4
      framework/system_settings.c
  2. 2
      gex.mk
  3. 7
      platform/lock_jumper.c
  4. 6
      platform/lock_jumper.h
  5. 1
      vfs/file_stream.c
  6. 2
      vfs/vfs_manager.c
  7. 2
      vfs/vfs_manager.h
  8. 8
      vfs/vfs_user.c

@ -5,14 +5,16 @@
#include "platform.h"
#include "utils/str_utils.h"
#include "system_settings.h"
#include "platform/lock_jumper.h"
struct system_settings SystemSettings;
void systemsettings_init(void)
{
SystemSettings.visible_vcom = true;
SystemSettings.editable = false; // This will be loaded in platform init based on the LOCK pin
SystemSettings.modified = false;
LockJumper_ReadHardware();
}
// to binary

@ -46,7 +46,7 @@ GEX_CDEFS = \
-DUSE_FULL_LL_DRIVER \
-DUSE_FULL_ASSERT=1 \
-DVERBOSE_ASSERT=1 \
-DDEBUG_VFS=0 \
-DDEBUG_VFS=1 \
-DVERBOSE_HARDFAULT=1 \
-DUSE_STACK_MONITOR=1 \
-DUSE_DEBUG_UART=1

@ -75,7 +75,7 @@ void LockJumper_Check(void)
// Read the pin state
bool old = SystemSettings.editable;
SystemSettings.editable = (bool) LL_GPIO_IsInputPinSet(lock_periph, lock_llpin);
LockJumper_ReadHardware();
if (old != SystemSettings.editable) {
// --- State changed ---
@ -84,3 +84,8 @@ void LockJumper_Check(void)
jumper_changed();
}
}
void LockJumper_ReadHardware(void)
{
SystemSettings.editable = (bool) LL_GPIO_IsInputPinSet(lock_periph, lock_llpin);
}

@ -17,4 +17,10 @@ void LockJumper_Init(void);
*/
void LockJumper_Check(void);
/**
* Check hardware jumper and load it's value into the settings struct.
* Does NOT trigger MSC changes or anything else.
*/
void LockJumper_ReadHardware(void);
#endif //GEX_LOCK_JUMPER_H

@ -238,7 +238,6 @@ static error_t close_conf(void *state)
ini_parse_end();
settings_read_ini_end();
// force a full remount to have the changes be visible
vfs_mngr_fs_remount(true);
return E_SUCCESS;

@ -38,6 +38,8 @@
// TRANSFER_NOT_STARTED || TRASNFER_FINISHED
#define DISCONNECT_DELAY_MS 500
bool vfs_is_windows = false;
// Make sure none of the delays exceed the max time
COMPILER_ASSERT(CONNECT_DELAY_MS < MAX_EVENT_TIME_MS);
COMPILER_ASSERT(RECONNECT_DELAY_MS < MAX_EVENT_TIME_MS);

@ -29,6 +29,8 @@
extern "C" {
#endif
extern bool vfs_is_windows;
/* Callable from anywhere */
// Enable or disable the virtual filesystem

@ -23,6 +23,7 @@
#include "framework/settings.h"
#include "platform.h"
#include "vfs_manager.h"
#include "str_utils.h"
const vfs_filename_t daplink_drive_name = "VIRTUALFS";
@ -67,6 +68,13 @@ void vfs_user_file_change_handler(const vfs_filename_t filename,
vfs_file_change_t change,
vfs_file_t file, vfs_file_t new_file_data)
{
if (strstarts(filename, "SYSTEM~1")) {
vfs_printf("ATENTION - we are dealing with windows! Careful or it will crash!");
// TODO take precautions
vfs_is_windows = true;
return;
}
if (VFS_FILE_CHANGED == change) {
// Unused
vfs_printf(">>> CHANGED %s", filename);

Loading…
Cancel
Save