How to control program-flow with a config-file on SD-Card?

Hi I read a value from an analog pin. The value should be latter manipulated by some function (lets say add Ofset, do Multiplication, do it only if Pin1 is high, and so on). If the Program-Flow is fix - no problem.

How can I make this configurable in a File on a SD-Card? That means: - User one: Read AnalogPin1, add 50 if DigitalPin1 - User two: Read AnalogPin1, add 575

And, yes, the User should define the flow (I have functions to an object they do the job) in a file.

As the programm needs to be compiled, I assume that it isn't possible. But is a way to do it better?

The Case is RC-Model - build a transmitter: The Throttle-Gimbal should control Channel1, but only if Switch 1 is on. Another user prefer to have the Throttle on Channel 3. A third User has another Gimbal as Airbrake. And if Airbrake is on, it should reduce Channel 1 with the throttle-output.

It would be great to make this changeable withou recompile the stuff.

You will need alternative code for the different options however the options are managed.

It seems to me it would be simple to have a few alternative functions which could be used. or not used, depending on how a switch (physical, not software statemet) is set. For example

if (switchPos == 0) {
   functionOne();
}
if (switchPos == 1) {
  functionTwo();
}

...R

You could use Bitlash to put your application logic on an SD card.

You could write your application configuration to a file on the SD card. For example, the cases you described could be implemented by storing each configuration as a transformation matrix.

If your application configuration is small enough to fit in the onboard EEPROM, you could put it in the EEPROM.

I guess you will want some way to select between the different 'users'. If you use an SD to hold the user-specific data then this can be achieved just by giving each user a different SD card. Otherwise I guess you'd need to have some additional input to select the current user.

Robin: This is a good idea and I will think on that. Probably it is not flexible enough

Peter: For each user a spare SD card is fine. In practice it is more a plane that a user, but I think it is easier to understand. The spare storage can then later also used to store the telemetry data of the flights and this is plane/user-specific as well.

Have you a "hello World" for Bitlash?

Have you a “hello World” for Bitlash?

Have you looked? I didn’t think so.