Increase number of routes/timers

Hello
I am trying to program a board (through Android) to work as a reminder (offline with the Timer module) but I am getting to the limit of routes that can be set on the board.
1.) Is there a way to increase the possible routes (or timers) on a board?

2.) Also, does the complexity of a route influence the number of possible routes? I am using the gyro-data with some map-operations to simulate randomization and have a bunch of different reacts hooked up on the data-outcome. Does this need more "routing-space" than a simple log-route?

3.) I have some timers that run only once. Is it possible that a timer destroys itself after it is finished (offline)?

4.) Furthermore, is it possible to let the board create timers on its own? Maybe preprogram them into a makro and let it be created when needed?

Thank you very much for any tips
Greetings from Vienna :)
Jodli

Comments

  • edited April 2018
    1. Timers: no, routes: yes, depending on the complexity (see q2)
    2. Yes, the more reactions, processors, loggers in the route, the less number of routes you can add, and the number of commands you can schedule with a timer or observer
    3. It is not possible with how the API currently represents the timer. The Timer interface would have to be completely redone.
    4. Yes, you can use the Macro interface to pre-program the timer setup then execute the commands at a later time
  • Thank you very much for your support!

    I am still unsure how to implement Timers that are created by Macros.
    If I do something like this:

    private byte macro_id=0;
    
    
    macroModule.startRecord(false);
        timerModule.scheduleAsync(30000, (short) 1, true, new CodeBlock() {
        @Override
        public void program() {
            vibrationModule.startMotor(100.f, (short) 1000);
        }
    }).continueWith(task -> {
        Timer.ScheduledTask scheduledTask = task.getResult();
        scheduledTask.start();
    
    
        macroModule.endRecordAsync().continueWith(new Continuation<Byte, Void>() {
            @Override
            public Void then(Task<Byte> macroStartTask) throws Exception {
                macro_id=macroStartTask.getResult();
    
                return null;
            }
        });
    
        return null;
    });
    

    Then the timer is just started on its own and the macroStartTask has an Error:
    "java.util.concurrent.TimeoutException: Did not received macro id within 1000ms"

    What am I doing wrong here?
    Or did you just mean that the commands that are issued by a route can be packed into a makro?

    I guess by packaging the commands that are issued by react-routes or timers, I can also decrease the space a route needs on the board (and can in turn increase the number of possible routes), right?

    Thanks again for your help :)

  • edited April 2018

    Start with the example code provided by the documentation. Does the led code work for your device? If not, then was your board in a clean state prior to running the code i.e. no timers, routes, logged data, etc.

    Yes, you could use the macro to pre-program commands though this raises the question of how many routes do you need? What is the goal if your app?

  • My apologies. I thought I had reset my board before testing. But apparently not. It works now. Also the example code works perfectly. Thank you very much :)

    But I have another question. I am unsure what exactly is recoreded by macros.

    For testing, I am trying to record the creation of a 3-second-timer (which starts the vibration-motor) into a makro. After the makro is completed, I remove the timer and start a 6-second-timer which in turn starts the makro (which then should recreate the first 3-second-timer).

    I have the following code:

    macroModule.startRecord(false);
    timerModule.scheduleAsync(3000, (short) 1, true, new CodeBlock() {
        @Override
        public void program() {
            vibrationModule.startMotor(100.f, (short) 1000);
        }
    }).continueWith(task -> {
        Timer.ScheduledTask scheduledTask = task.getResult();
        scheduledTask.start();
    
        macroModule.endRecordAsync().continueWith(new Continuation<Byte, Void>() {
            @Override
            public Void then(Task<Byte> macroStartTask) throws Exception {
                scheduledTask.remove();
                final byte macro_id = macroStartTask.getResult();
    
                timerModule.scheduleAsync(6000, (short) 1, true, new CodeBlock() {
                    @Override
                    public void program() {
                        macroModule.execute(macro_id);
                    }
                }).continueWith(task2 -> {
                    Timer.ScheduledTask scheduledTask2 = task2.getResult();
                    scheduledTask2.start();
                    return null;
                });
    
    
                return null;
            }
        });
        return null;
    });
    

    This partly works. It seems like the 3-second-timer is created and removed and the makro recreates it like it should. But the board seems to be stuck in an endless loop and vibrates every 6 seconds. So it seems that the macro is recording the creation of both timers (?) and I dont really understand why.

    The goal of my app is to have several daily reminders on the board at fixed/ random times.
    So, every reminder needs two timers. One infinite timer that buzzes every 24 hours and a wait-timer that starts the buzzer-timer at the right time of day (the wait timer can then be removed).
    For random reminders I create several timers and then use react routes on the gyro-data (because it seems to be the only sensor on the board that produces enough decimal places that seem fairly random) to decide which timer should be started.

    It all works fairly well but the number of reminders that are possible, is very limited (especially with my random-reminder-solution) so I am trying to reduce the number of routes that are present on the board at the same time.

  • edited April 2018

    Move scheduledTask.remove() into the continuation of the second timer:

    timerModule.scheduleAsync(6000, ...).continueWith(task2 -> {
        scheduledTask.remove();
    
        Timer.ScheduledTask scheduledTask2 = task2.getResult();
        scheduledTask2.start();
        return null;
    });
    
This discussion has been closed.