Skip to content

Commit

Permalink
Merge branch 'MobiFlight:main' into Fast_IO
Browse files Browse the repository at this point in the history
  • Loading branch information
elral authored Jan 10, 2024
2 parents 9aebc49 + f883fe9 commit 3e73dbb
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 4 deletions.
10 changes: 8 additions & 2 deletions get_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,17 @@
firmware_version = firmware_version.lstrip("v")
firmware_version = firmware_version.strip(".")

# The community devices have a slightly different version where the
# core firmware version is defined within there .ini file
# For the core FW both versions are always the same
core_firmware_version = firmware_version

print(f'Using version {firmware_version} for the build')
print(f'Using version {core_firmware_version} as core version')

# Append the version to the build defines so it gets baked into the firmware
# Append the version and core version to the build defines so it gets baked into the firmware
env.Append(CPPDEFINES=[
f'BUILD_VERSION={firmware_version}'
f'BUILD_VERSION={firmware_version}', f'CORE_BUILD_VERSION={core_firmware_version}'
])

# Set the output filename to the name of the board and the version
Expand Down
2 changes: 2 additions & 0 deletions src/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
#define STRINGIZER(arg) #arg
#define STR_VALUE(arg) STRINGIZER(arg)
#define VERSION STR_VALUE(BUILD_VERSION)
#define CORE_VERSION STR_VALUE(CORE_BUILD_VERSION)

MFEEPROM MFeeprom;

Expand Down Expand Up @@ -554,6 +555,7 @@ void OnGetInfo()
cmdMessenger.sendCmdArg(name);
cmdMessenger.sendCmdArg(serial);
cmdMessenger.sendCmdArg(VERSION);
cmdMessenger.sendCmdArg(CORE_VERSION);
cmdMessenger.sendCmdEnd();
}

Expand Down
21 changes: 20 additions & 1 deletion src/MF_CustomDevice/CustomDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
Normally nothing has to be changed in this file
It handles one or multiple custom devices
********************************************************************************** */

#define MESSAGEID_POWERSAVINGMODE -2

namespace CustomDevice
{
MFCustomDevice *customDevice;
Expand Down Expand Up @@ -84,4 +87,20 @@ namespace CustomDevice
customDevice[device].set(messageID, output); // send the string to your custom device
}

} // end of namespace
/* **********************************************************************************
This function is called if the status of the PowerSavingMode changes.
'state' is true if PowerSaving is enabled
'state' is false if PowerSaving is disabled
MessageID '-2' for the custom device for PowerSavingMode
********************************************************************************** */
void PowerSave(bool state)
{
for (uint8_t i = 0; i < customDeviceRegistered; ++i) {
if (state)
customDevice[i].set(MESSAGEID_POWERSAVINGMODE, "1");
else
customDevice[i].set(MESSAGEID_POWERSAVINGMODE, "0");
}
}

} // end of namespace
1 change: 1 addition & 0 deletions src/MF_CustomDevice/CustomDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ namespace CustomDevice
void Clear();
void update();
void OnSet();
void PowerSave(bool state);
}
2 changes: 1 addition & 1 deletion src/MF_OutputShifter/MFOutputShifter.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <Arduino.h>
#include "MFFastIO.h"

#ifdef REVERSED_OUTPUT_OUTPUT
#ifdef REVERSED_OUTPUT_OUTPUTSHIFTER
#define MF_HIGH LOW
#define MF_LOW HIGH
#else
Expand Down
3 changes: 3 additions & 0 deletions src/mobiflight.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ void SetPowerSavingMode(bool state)
#if MF_STEPPER_SUPPORT == 1
Stepper::PowerSave(state);
#endif
#if MF_CUSTOMDEVICE_SUPPORT == 1
CustomDevice::PowerSave(state);
#endif

#ifdef DEBUG2CMDMESSENGER
if (state)
Expand Down

0 comments on commit 3e73dbb

Please sign in to comment.