Forum Software Ferduino code Fedeer reminder

Fedeer reminder  [SOLVED]


Post Number:#1 Post Fri Jun 02, 2017 3:13 pm
Posts: 69
Topics: 18
Images: 2
Solve rating: 1
Joined: Tue Apr 14, 2015 11:54 pm
Topics: 18
Age: 42
Gender: Male
National Flag:
Indonesia
halo fernando,
I want to add feed notification countodwn timer in front panel :
Like "next feeder : xxxx minutes,
but i dont know, where to find to insert the code to this result,
my plan will add notification like in the picture below red circle.

next feed ; xxx minutes
Image


thanks
diztly wardizt

Post Number:#2 Post Sun Jun 04, 2017 9:42 am
Posts: 1699
Topics: 38
Images: 301
Solve rating: 233
Joined: Mon Mar 03, 2014 5:59 pm
Topics: 38
Age: 39
Location: São Paulo
Gender: Male
National Flag:
Brazil

Hi!

Your image is not available.

The function to check the text file should be like this:

if (file.open("FEEDER.TXT", O_READ))
{
  while ((n = file.read(buf, sizeof(buf))) > 0)
  {
    minuto01 = atoi(buf);
    if (minuto01 >  NumMins(t.hour, t.min))
    {
      // Copy only the first value to a variable. Then calculate the time to next feeding. NumMins(t.hour, t.min) is the current time in minutes.
    }
  }
  file.close();
}


Look the function for feeder here: https://github.com/FernandoGarcia/Ferdu ... co.ino#L21

Best regards.
Post your doubts on forum because it can help another user too. Just PM me for support if it's absolutely necessary.

Post Number:#3 Post Mon Jun 05, 2017 12:38 pm
Posts: 69
Topics: 18
Images: 2
Solve rating: 1
Joined: Tue Apr 14, 2015 11:54 pm
Topics: 18
Age: 42
Gender: Male
National Flag:
Indonesia
thanks

images can not load from google drive

Image

i try this



if (file.open("FEEDER.TXT", O_READ))
{
  int16_t n;
  char buf[7];
  int minuto01 = 0;
  int minuto11 = 0;

  while ((n = file.read(buf, sizeof(buf))) > 0)
  {
    minuto01 = atoi(buf);
    if (minuto01 >  NumMins(t.hour, t.min))
    {   
        if (minuto11 < 10)
        {
          myGLCD.printNumF(minuto01,80, 192);

        }
        else if (( minuto11 > 10) && (minuto11 < 100))
        {
          myGLCD.printNumF(minuto01,80, 192);

        }
        else if (( minuto11 >= 100) && (minuto11 < 1000))
        {
          myGLCD.printNumF(minuto01,80, 192);
         
        }
        else if (minuto11 >= 1000)
        {
          myGLCD.printNumF(minuto01,80, 192);       
        }
      // Copy only the first value to a variable. Then calculate the time to next feeding. NumMins(t.hour, t.min) is the current time in minutes.
    }
  }
  file.close();
}


Maybe this is too difficult for me to understand :(( :((

but
thanks for your attention

best regard.

Post Number:#4 Post Mon Jun 05, 2017 1:25 pm
Posts: 1699
Topics: 38
Images: 301
Solve rating: 233
Joined: Mon Mar 03, 2014 5:59 pm
Topics: 38
Age: 39
Location: São Paulo
Gender: Male
National Flag:
Brazil

Hi!

Try understand what the code does before. It's more easy than you are doing.

Add to "Ferduino" tab:

int reminder = 0;


Add to "Alimentador_automatico" tab:

void FeederReminder()
{
  int16_t n;
  char buf[7];
  int minuto01 = 0;
  boolean match = false;

  if (file.open("FEEDER.TXT", O_READ))
  {
    while ((n = file.read(buf, sizeof(buf))) > 0)
    {
      minuto01 = atoi(buf);
      if (minuto01 >  NumMins(t.hour, t.min))
      {
        if (match == false)
        {
          match = true;
          reminder = minuto01;
        }
      }
    }
    file.close();
  }
}


On loop find:

check_alimentador();


Add after:

FeederReminder();



In "Inicio" tab find:

myGLCD.setColor(161, 127, 73);


Add before:

    if (reminder > 0) // Adjust this part according to your requirements.
    {
      myGLCD.printNumI(reminder - NumMins(t.hour, t.min), x, y);
    }


Best regards.
Post your doubts on forum because it can help another user too. Just PM me for support if it's absolutely necessary.

Post Number:#5 Post Thu Jun 08, 2017 3:08 am
Posts: 69
Topics: 18
Images: 2
Solve rating: 1
Joined: Tue Apr 14, 2015 11:54 pm
Topics: 18
Age: 42
Gender: Male
National Flag:
Indonesia
:x :x

wow thanks, is working, but little problem,

if in idle condition (night) minus number

Example; Feed live set at 08.00 - 16.00 normal running number.
but if 16.00 - 08.00 - numbers indicate minus.


thanks
best regard

Post Number:#6 Post Mon Jun 19, 2017 7:39 am
Posts: 69
Topics: 18
Images: 2
Solve rating: 1
Joined: Tue Apr 14, 2015 11:54 pm
Topics: 18
Age: 42
Gender: Male
National Flag:
Indonesia
Sorry, I've tried some code but can not succes.

//=========
    if ((reminder > 180) &&(bitRead(alimentacao_wavemaker_on_off, 0) == true)) // Adjust this part according to your requirements.
    {
      myGLCD.printNumI(reminder - NumMins(t.hour, t.min), x, y);
    }
    else  // if ((reminder == NumMins(t.hour, t.min)) &&(bitRead(alimentacao_wavemaker_on_off, 0) == true))
    {
      myGLCD.print("IDLE", x, y);
    }
//========



I want when the feeder function is more than 3 hours waiting, the status becomes idle.
#:-s


best regards

Post Number:#7 Post Tue Jun 20, 2017 10:27 am
Posts: 1699
Topics: 38
Images: 301
Solve rating: 233
Joined: Mon Mar 03, 2014 5:59 pm
Topics: 38
Age: 39
Location: São Paulo
Gender: Male
National Flag:
Brazil

Hi!

Try understand what you are doing first.

"reminder" is the time to next dosage in minutes. So if do you want know if the interval to next dosage is higher than 3 hours you should make like this:

if((reminder -  NumMins(t.hour, t.min)) > 180)


Best regards.
Post your doubts on forum because it can help another user too. Just PM me for support if it's absolutely necessary.

Post Number:#8 Post Thu Jul 27, 2017 10:17 am
Posts: 69
Topics: 18
Images: 2
Solve rating: 1
Joined: Tue Apr 14, 2015 11:54 pm
Topics: 18
Age: 42
Gender: Male
National Flag:
Indonesia
thanks fernando,
Code works well, there are constraints in the minus numbers when the night, I do not understand how to resolved this problem.

Actually I like this, just try some of my code does not work,
especially after hours to the turn to AM and PM

Image

sorry my english to bad

Thanks

Post Number:#9 Post Thu Jul 27, 2017 11:26 am
Posts: 1699
Topics: 38
Images: 301
Solve rating: 233
Joined: Mon Mar 03, 2014 5:59 pm
Topics: 38
Age: 39
Location: São Paulo
Gender: Male
National Flag:
Brazil

Hi!

I don't understand what you are doing.

In my code if you try set the time as 18:00 to 6:00, you will get this error:

Image


"The end time can't be smaller than start time!"

If you are converting the time to 12 h format you should use the time from RTC directly not converted time.

Using the web interface you could get this info:

Image


Notice that the last dosage is 18:20 so reminder is 1100 or (18 * 60) + 20.

Therefore if current time is 18:21 reminder will be 1101 so doing reminder - curreent time (1100 - 1101) you will get -1.

Using this condition you will avoid negative time after all dosages has been done.

if((reminder -  NumMins(t.hour, t.min)) > 0)


Best regards.
Post your doubts on forum because it can help another user too. Just PM me for support if it's absolutely necessary.




Return to Ferduino code





Who is online

Users viewing this topic: No registered users and 1 guest

cron