#Arduino Help

10534 messages · Page 11 of 11 (latest)

wary cloak
#

Let's see how many times until it doesn't work?

#

Second time goes well

old mango
#

Yep

wary cloak
#

Third time also

old mango
#

Repetition is good for finding heisenbugs like these

wary cloak
#

Fourth also mmm

#

Let's try

#

Combining functions

#

Now I will do charging money

#

Doesn't work

#

I will reset

#

Let's try it again

#

Charging money

#

It works

#

Let's go read saldo

#

It works

#

Let's try charging money again

#

Mmm

#

It worked

#

Then read saldo again

#

It worked

#

Well now it's all working huh, yeah but when I'm testing it doesn't

#

Mm

#

Let's try to buy then

#

It worked wtf

#

And reading

#

That's weird

#

But I told you those other two cases when it stopped working

#

That's why I call it inconsistency

#

It went from failing a lot from being perfect now

#

Ok now let's try master mode then

#

Works

#

Read saldo

#

It doesn't

#

Finally

#

Ok let's reset

#

Now I will try

#

Read saldo

#

Do master mode

#

And try read saldo again

#

It works

#

Any conclusion yet(?

#

I'm really lost there's no pattern

#

Aha

#

No I went charge money it didn't work

#

And there were only 4 operations this time

#

Ok let's try repeat that behavior

#

Read saldo
Master mode
Read saldo
Charge money

#

It worked

#

Any more test?

old mango
#

So, is it still being inconsistent?

wary cloak
#

Yes as you read

#

Because I did that for operation thing and it didn't work but then repeat it and it did

#

4 operation*

old mango
#

I think it's something to do with the halt state

#

If you repeat the operations quickly does it it have issues more often than when you pause in between?

wary cloak
#

I don't think so but we could try

#

For example ver saldo

#

Has like a

#

10 second delay

old mango
#

Pause as in move the card away from the reader for a while

wary cloak
#

Buy well the time I take you write the number

#

and so on

wary cloak
old mango
#

Actually, hmm. Try commenting out all the HaltA calls and see if you still have issues?

wary cloak
#

All?

#

Isn't it necessary to do that with stop crypto?

old mango
#

I'm not 100% clear on that

wary cloak
#

Ok let's try

old mango
#

And ISO 14443 (the relevant specification) costs money to buy

wary cloak
#

Tho as you see it takes time to get the inconsistency

#

Or not

#

Because it's inconsistent(?

old mango
#

PICC_IsNewCardPresent documentation says that 'Sleeping cards in state HALT are ignored'

wary cloak
#

I saw something interesting

#

Here there's not a haltA

#

There's in the if not in the else

old mango
#

There also not StopCrypto

wary cloak
#

Maybe it's fine but saying

#

Btw I think I comented all

old mango
#

Well, give it a shot, ig?

#

Hopefully doesn't cause any issues

wary cloak
#

But in any case if that was the issue it would always fail when getting there but then there's this other try when I did the 4 operation going through master mode again and nothing happened so

#

Went to

#

Leer saldo

#

Did it two times, third it got stuck

#

Let's repeat the behavior

#

And see if it gets stuck again

#

It doesn't work now

#

In first try

#

Reset again

#

Now it works

#

Tch

#

Just when I thought we found a common behavior

#

And if I do it a second time it works too

#

Third time also

#

Any other idea or keep testing?

old mango
#

Well, I'd uncomment those lines you changed

#

Add any missing haltA or stopCrypto

wary cloak
#

I hope I didn't go too back

#

Cause I saw int precio again

#

Got rid of it ofc

old mango
#

If it still doesnt work, maybe try PICC_REQA_or_WUPA?

wary cloak
wary cloak
old mango
#

Can do a ctrl-F in the MFRC522.cpp

#

I think it's documented there

#

Or, hmm, actually

wary cloak
#

Well it's getting really late so I think we better at least for now don't continue on with this because it can end up being a lot of wasted time maybe that's another thing we should leave alone and deal with it because It just doesn't make sense either

old mango
#

PICC_IsNewCardPresent is what i think is the culprit

wary cloak
#

I mean it could be

old mango
#

Because it only works on cards in the IDLE state

wary cloak
#

Remember that

old mango
#

And doesnt do anything to cards in HALT

wary cloak
#

Where I first discovered and were more often

#

We're with new card present in master mode

#

Remember when I told you when printing it I got

#

11111110000011111100000111000010011

#

And once I had to

#

Read the card 7 times

#

Wait so maybe

#

When doing this process

#

I get to the haltA state

#

So when I ask for a new card present I get ignored?

old mango
#

Yeah

wary cloak
#

Tho I mean even then

old mango
#

I think the card eventually goes back into IDLE

#

Im just not sure how that process works

wary cloak
#

That wouldn't explain the inconsistency because I always go through haltA and go to a new card present again

#

Ig

#

Mmm

#

So maybe it's merely a hardware very specific issue?

old mango
#

Cuz it's an RFID card, it doesn't have onboard power, so it's probably going to reset itself within a certain amount of time

wary cloak
#

So may he it's time

#

Well I think we can't do anything else about it

#

So there's this last thing of the personalized characters and

#

It would be done

#

Bye bye rfid

old mango
#

Do you have your reader's data sheet?

wary cloak
#

I will try this one

#

Well above they sort it out(?

#

Somehow

#

.

#

.

#

.

#

.

#

Like that

#

Tho they found it in the document or smth

#

Just when you came

#

Anyways I'm trying this

#
lcd.createChar(0x01, {
0x0d, //0,0,0,0,1,1,0,1
0x12, //0,0,0,1,0,0,1,0
0x00, //0,0,0,0,0,0,0,0
0x16, //0,0,0,1,0,1,1,0
0x19, //0,0,0,1,1,0,0,1
0x11, //0,0,0,1,0,0,0,1
0x11, //0,0,0,1,0,0,0,1
0x11, //0,0,0,1,0,0,0,1
});
#

Replacing every place when an ñ should be with \x01

#

Tho then even if it worked I still need the ¿

#
C:\Users\fuchi\OneDrive\Documentos\Arduino\bartender_sin_sensores\bartender_sin_sensores.ino: In function 'void setup()':
bartender_sin_sensores:197:6: error: no matching function for call to 'LiquidCrystal_I2C::createChar(int, <brace-enclosed initializer list>)'
     });
      ^
In file included from C:\Users\fuchi\OneDrive\Documentos\Arduino\bartender_sin_sensores\bartender_sin_sensores.ino:1:0:
C:\Users\fuchi\OneDrive\Documentos\Arduino\libraries\LiquidCrystal_I2C/LiquidCrystal_I2C.h:79:8: note: candidate: void LiquidCrystal_I2C::createChar(uint8_t, uint8_t*)
   void createChar(uint8_t, uint8_t[]);
        ^~~~~~~~~~
C:\Users\fuchi\OneDrive\Documentos\Arduino\libraries\LiquidCrystal_I2C/LiquidCrystal_I2C.h:79:8: note:   no known conversion for argument 2 from '<brace-enclosed initializer list>' to 'uint8_t* {aka unsigned char*}'
exit status 1
no matching function for call to 'LiquidCrystal_I2C::createChar(int, <brace-enclosed initializer list>)'
#

@hallow hinge it didn't work

hallow hinge
#

linaflop I hate C

wary cloak
#

Cpp in any case (?

hallow hinge
#
uint8_t ENYE[8] = {
0x0d, //0,0,0,0,1,1,0,1
0x12, //0,0,0,1,0,0,1,0
0x00, //0,0,0,0,0,0,0,0
0x16, //0,0,0,1,0,1,1,0
0x19, //0,0,0,1,1,0,0,1
0x11, //0,0,0,1,0,0,0,1
0x11, //0,0,0,1,0,0,0,1
0x11, //0,0,0,1,0,0,0,1
};

lcd.createChar(0x01, ENYE);

maybe?

wary cloak
#

In setup right?

hallow hinge
#

Yes

wary cloak
#

And the for example

#

contrase\x01a

#

right?

#

It uploaded but with a warning

#
C:\Users\fuchi\OneDrive\Documentos\Arduino\bartender_sin_sensores\bartender_sin_sensores.ino: In function 'void setup()':
C:\Users\fuchi\OneDrive\Documentos\Arduino\bartender_sin_sensores\bartender_sin_sensores.ino:199:28: warning: invalid conversion from 'char*' to 'uint8_t* {aka unsigned char*}' [-fpermissive]
   lcd.createChar(0x01, ENYE);
                            ^
In file included from C:\Users\fuchi\OneDrive\Documentos\Arduino\bartender_sin_sensores\bartender_sin_sensores.ino:1:0:
C:\Users\fuchi\OneDrive\Documentos\Arduino\libraries\LiquidCrystal_I2C/LiquidCrystal_I2C.h:79:8: note:   initializing argument 2 of 'void LiquidCrystal_I2C::createChar(uint8_t, uint8_t*)'
   void createChar(uint8_t, uint8_t[]);
        ^~~~~~~~~~
#

Tho it doesn't work

#
void modoMaestro(){
  lcd.clear();
  int password_len = EEPROM.read(254);
  
  imprimir(
    empty,
    { "Ingrese la", 'c' },
    { "contrase\x01a", 'c' }
    );
old mango
#

Can you show your setup()?

wary cloak
#
void setup() {
  pinMode(PIN_ACOMPANANTE3, OUTPUT);
  pinMode(PIN_ACOMPANANTE2,OUTPUT);
  pinMode(PIN_ACOMPANANTE1,OUTPUT);
  pinMode(PIN_ALCHOHOL,OUTPUT);
  digitalWrite(PIN_ALCHOHOL,HIGH);
  digitalWrite(PIN_ACOMPANANTE1,HIGH);
  digitalWrite(PIN_ACOMPANANTE2,HIGH);
  digitalWrite(PIN_ACOMPANANTE3,HIGH);
  lcd.init();
  lcd.backlight();      
  SPI.begin();
  mfrc522.PCD_Init();
  //EEPROM.update(255,255);
  if(EEPROM.read(255) == 255){  CreatePassword(); }
  char ENYE[8] = {
  0x0d, //0,0,0,0,1,1,0,1
  0x12, //0,0,0,1,0,0,1,0
  0x00, //0,0,0,0,0,0,0,0
  0x16, //0,0,0,1,0,1,1,0
  0x19, //0,0,0,1,1,0,0,1
  0x11, //0,0,0,1,0,0,0,1
  0x11, //0,0,0,1,0,0,0,1
  0x11, //0,0,0,1,0,0,0,1
  };
  
  lcd.createChar(0x01, ENYE);
}
old mango
#

Try doing createChar before you init

wary cloak
#

Ok

wary cloak
old mango
#

Oh actually nvm dont

old mango
wary cloak
#

Well I already tried that and it failed (?

#

Maybe the warnings have a clue?

old mango
#

No, that should be ok

wary cloak
#

Wait.

hallow hinge
#

I edited it but forgot to message lol

old mango
#

Looking at it, you might have to use lcd.printByte or lcd.write (not sure what it's called) to write custom characters

wary cloak
old mango
#

Or maybe print()?

wary cloak
#

Mmm

old mango
#

LiquidCrystal_I2C is abandoned so it's hard to see what exactly the correct way is

wary cloak
#

It would look so bad tho combining my function with a normal one

#

can't we maybe change my function?

#

To accept that?

old mango
#

Idk, maybe?

wary cloak
old mango
#

I think you might need lcd.write for custom chars

wary cloak
#

Could be

#

Could try in setup maybe

#
void setup() {
  pinMode(PIN_ACOMPANANTE3, OUTPUT);
  pinMode(PIN_ACOMPANANTE2,OUTPUT);
  pinMode(PIN_ACOMPANANTE1,OUTPUT);
  pinMode(PIN_ALCHOHOL,OUTPUT);
  digitalWrite(PIN_ALCHOHOL,HIGH);
  digitalWrite(PIN_ACOMPANANTE1,HIGH);
  digitalWrite(PIN_ACOMPANANTE2,HIGH);
  digitalWrite(PIN_ACOMPANANTE3,HIGH);
  lcd.init();
  lcd.backlight();      
  SPI.begin();
  mfrc522.PCD_Init();
  //EEPROM.update(255,255);
  if(EEPROM.read(255) == 255){  CreatePassword(); }
  uint8_t ENYE[8] = {
    0x0d, //0,0,0,0,1,1,0,1
    0x12, //0,0,0,1,0,0,1,0
    0x00, //0,0,0,0,0,0,0,0
    0x16, //0,0,0,1,0,1,1,0
    0x19, //0,0,0,1,1,0,0,1
    0x11, //0,0,0,1,0,0,0,1
    0x11, //0,0,0,1,0,0,0,1
    0x11, //0,0,0,1,0,0,0,1
    };
  
  lcd.createChar(0x01, ENYE);

  lcd.clear();
  lcd.print("\x01");
  lcd.clear();

  delay(5000);

  lcd.clear();
  lcd.write("\x01");
  lcd.clear();

  delay(5000);
}
old mango
#

Oh, no

wary cloak
#

?

old mango
#

lcd.write(1) not write("\x01")

wary cloak
#

Ok it didn't work it didn't show anything

wary cloak
#

I'm trying it with my function tho

#

Rn

#

Nah there it doesn't work

old mango
#

If that doesnt work, switch from createChar(1, ...) to createChar)(0, ...) and then try with lcd.write(0)

wary cloak
#

Tho I realized

#

The delay is wrong bruh

#

Well

#
lcd.clear();
  lcd.print("\x01");
  delay(5000);
  lcd.clear();
  lcd.write("\x01");
  delay(5000);
  lcd.clear();
old mango
#

Wait that's the wrong lcd.write tho

wary cloak
#

That worked

#

Tho it first printed the ñ then a 0 for some reason

#

I will see what happens I only do print

#

Not write

#

It works

#

Weird but

#

If it works with print

#

Why doesn't it with my function?

#

I have one theory tho

#

"\x01" Does this really count like one character?

old mango
#

Yes, it does

wary cloak
#

Because I have 20 character limit and the contraseña it's not short word

#

Is that I thought

old mango
#

That's something that C++ itself handles

wary cloak
#

Since it's says "contrase"

#

Not even

#

Contrasea

#

I thought maybe it run out of space

#

Why does the A disappear

#

BTW

wary cloak
#

It prints a 0 with a line at the middle or smth like that

#

It works with print but

#

Then

old mango
#

With write(1) or write("\x01")?

wary cloak
#

Why not with my function that uses print

wary cloak
#

Now I will try print with 1

#

It doesn't

#

lcd.print("\x01");

#

this is the way

#

But again

wary cloak
old mango
#

Okay gimme a sec, i have an i2c lcd and an arduino lying around here somewhere

wary cloak
#

Sure and I will leave my function here I sent it to a friend once so

#

I have it by itself

old mango
#

Starting a project myself anyway so i can check this rl quick

wary cloak
#
struct PrintOptions {

  String toPrint;

  int pos;

};

 

const PrintOptions empty = {"", 0};

 

 

void imprimirFila(byte posY, byte posX, String fila){

  if(fila != ""){

    byte caracteres_restantes = 20 - fila.length();

 

    if(caracteres_restantes<0){

      lcd.print("muy largo 1");

    }

  byte posicionX = posX == 'c'? (caracteres_restantes/2) : posX;

  lcd.setCursor(posicionX,posY);

  lcd.print(fila);

 

  }

}

 

void imprimir(PrintOptions fila1 = empty, PrintOptions fila2 = empty, PrintOptions fila3 = empty, PrintOptions fila4 = empty) {

  imprimirFila(0, fila1.pos, fila1.toPrint);

  imprimirFila(1, fila2.pos, fila2.toPrint);

  imprimirFila(2, fila3.pos, fila3.toPrint);

  imprimirFila(3, fila4.pos, fila4.toPrint);

}

 

Ejemplos:

 

do{

    imprimir(

    { "Elija una bebida",  'c' },

    { "1-Fernet con Coca",  0  },

    { "2-Sex on the beach", 0  },

    { "3-Agua",             0  }

    );

 

do{

    imprimir(

    { "Elija una bebida",  'c' },

    { "1-Fernet con Coca",  0  },

    { "2-Sex on the beach", 0  },

    { "3-Agua",             0  }

    );

 

 

imprimir(

    empty,

    { "preparando...", 'c'}

    );
old mango
#

I already have it, no need

wary cloak
#

Oh ok

#

I was going to try this

#
imprimir(
    { "\x01",  'c' },
    );
  delay(5000);
  lcd.clear();
#

And it works

#

So

#

My function can print the ñ

#

Now

wary cloak
#

For example

#
imprimir(
    { "\x01a",  'c' }
    );
  delay(5000);
  lcd.clear();

}
#

This prints nothing

#

Like in that other case

#
imprimir(
    { "\x01 a",  'c' }
    );
#

It works but

#

There's and space between the two

#

There should be a way to print them together

#

@coral geyser happen to now?

#

Know*

#

And if case still around @hallow hinge any clue?

hallow hinge
#

"\x01" "a" should work without space

old mango
#

Aight, found my stuff, writing

wary cloak
#

Nice

wary cloak
#

Ok it works

#

Noe let's try it in a real scenario

#

Now*

#

Lot's of errors

#

No wait

#

Ok solve that

#

Let's see

#

It wooooorks

#

Now I will implement it everywhere and see if it's done

#

@hallow hinge thank you for the ñ

#

Think you could the ¿ and we call it a day?

#

Tho I still have to check the ñ works everywhere but it likely does

#

It works everywhere yay

#

@old mango the ñ affair has been solved

#

Tho there's only one issue

#
imprimir(
    { "contrase""\x01""a" "correcta.",  'c' },
    { "Acerque la tarjeta", 'c' },
    { "al lector", 'c' }
    );
#

No clue why there's no space there

#

I tried doing and extra space also

#

Any idea?

#

:D

#

I created ¿

#

By my own

#
uint8_t QUESTION[8] = {
    0x00, //0,0,0,0,0,0,0,0
    0x04, //0,0,0,0,0,1,0,0
    0x00, //0,0,0,0,0,0,0,0
    0x04, //0,0,0,0,0,1,0,0
    0x08, //0,0,0,0,1,0,0,0
    0x10, //0,0,0,1,0,0,0,0
    0x11, //0,0,0,1,0,0,0,1
    0x0e, //0,0,0,0,1,1,1,0
    };
#

So Happy

#

Now let's see if I can use it

#

It woooorks

wary cloak
wary cloak
#

And that's it

#

There's nothing else

#

@old mango I hope you aren't doing a whole setup for the lcd(?

#

@oblique bridge could you help me solve this last issue?

#

Well ig this will have to he left for a 2 minute section tomorrow

old mango
#

Looks like you got it working tho

wary cloak
#

I just experienced another inconsistency trying to read money for the first time

#

Since it's the first time I don't think time played a role here

#

But again

#

I don't know if we can do anything about it

wary cloak
wary cloak
old mango
#

You have "contraseña""correcta" there are no spaces in that to begin with?

wary cloak
#

There are

old mango
#

Not in that string you're passing it

wary cloak
#

"contrase""\x01"" a" "correcta"

#

And even if I did

#

Another space

#

It doesn't change

old mango
#

There's a space before the a but none between a and correcta

wary cloak
#

Oooh

#

Let's see

#

Done

#

Bye bye cpp rfid I hope at least you made me a better programmer

#

Ofc we have two little details

#

That of "the card is already in the system" Affair we couldn't solve and the inconsistentencies

#

So it's not 100% perfect but at least like 90

old mango
wary cloak
#

Sorry for that

old mango
#

Nah np

#

Most of it was just finding stuff

wary cloak
#

Now finally before I went to sleep I wanted to tell you what's next tho maybe we aren't working on it for a week of something I ain't sure about that because I don't have the components yet and I have a small issue when I do

old mango
#

And like i said i have a project I'm starting soon anyway so not like it was out of my way or anything

wary cloak
#

So next two components and last

#

4 Ultrasound sensors and 1 infrared?

#

Idk how you call it in English

old mango
#

About the same

wary cloak
#

Basically if there's a glass you can serve the drink on keep on buddy, if not, it won't work

old mango
#

Ultrasonic & infrared, prolly

#

Ultrasound is more the medical thing, in common speech at least

wary cloak
#

And the ultrasonic would be on the top of the recipient so it would warn you hey you have 3 uses left, and then it would say, fill me or I won't work

#

Basically that

#

Pretty easy right?

#

I already have an ultrasonic code that use as a base, it's pretty simple and there are no libraries involved

#
#define trig 10
#define echo 9
float tiempo;
float dist;

void setup() {
pinMode (trig, OUTPUT);
pinMode (echo, INPUT);
Serial.begin(9600);
}



void loop() {

digitalWrite(trig, HIGH);
delayMicroseconds(10);
digitalWrite(trig, LOW);
tiempo= pulseIn(echo, HIGH);
dist=tiempo*0.01715;
if(dist<=300)
{Serial.print("Distancia en cm: ");
Serial.println(dist);
delay(500);}
else
{Serial.println("Muy lejos");
delay(500);}

}
#

Now ofc

#

First this Wednesday I should show all the rfid stuff but aside from that we are testing the base functionality irl last time it didn't work

#

So they maybe tell me don't get onto new stuff if old one doesn't work at all

#

Or even then my partner takes it's time to buy the sensors

old mango
#

Didnt really understand what you were saying but those are fairly simple sensors so there shouldn't be any issues for you

wary cloak
#

All sort of stuff could happen

wary cloak
#

I have only one issue

#

Ofc since I have a MEGA likely I have enough pins left for the sensors

#

But you know what I don't have more of?

#

VCC and GND

#

So yeah though trying them

#

At least all the components together

#

It's going to be a pain

#

And also testing ultrasonic would requiere it to be where it needs to because you know it won't work as intended if not and also

#

It's really imprecise

old mango
#

Oh, yeah, ultrasonic is indeed somewhat imprecise

wary cloak
#

But yeah that and

#

The project is done

#

Maybe I could make it better but

#

Not with more components and libraries

#

But with what I already have

#

For example for now it works only in one case one drink, I could change that

#

And honestly I would be up to make more personalized characters

#

Like a bottle or something cool

old mango
#

Can prolly expect a few percent off, more if it's not a flat surface or the sensors are low quality

wary cloak
#

I will measure the distance and pick the lowest and highest

#

That was my idea

old mango
#

Also they usually have a minimum range that you need to keep in mind

#

Oh, and it'll also be affected by temperature and humidity to a certain extent

wary cloak
#

Really?

old mango
#

Air pressure, too, iirc

wary cloak
#

Well in any case we already tested it on water

old mango
#

Yeah, used an ultrasonic sensor for measuring change in speed of sound with temperature/pressure/humidity

wary cloak
#

Well so as you see no clue when are we continuing this ofc we could program without the components so when we have there's less work but idk

#

So I guess I may continue the rust re writting, bye bye cpp rfid hello rust rfid

#

Well gn, and thank you very much a nightmare has finished (?

arctic mist
#

guys what the fuck

#

that is impressive

wary cloak
coral geyser
#

This thread has been at the top of #981431291683700776 for what 2 weeks now?

wary cloak
#

@coral geyser question

#

So tomorrow I'm having that class again

#

About the USB

#

The only thing I should different is when finishing the setup I should run all comands with "--offline"? Like "cargo check --offline"?

coral geyser
#

Yeah that's all I can think of

#

Other than remaking it with a different filesystem so rustup and cargo behave normally

wary cloak
#

Btw I would like to retake the rust re writting and so since the cpp one is really advanced now

#

Tho not today

#

Like in two days

#

Could you help me again?

coral geyser
coral geyser
wary cloak
#

Mmm well in that case

#

If it doesn't work the offline

#

I will use my own pass all the stugf again

#

And it that one

#

We can do what you just said

coral geyser
#

All the weird errors you have seen with it on the other computers is because cargo tries to do something that fat32 doesn't support and it gets really confused. I am hoping using --offline will make it not try to do those things

wary cloak
#

Oh

#

Tho..

#

What's fat32?

coral geyser
#

https://en.m.wikipedia.org/wiki/NTFS is what windows uses for it's main drives

New Technology File System (NTFS) is a proprietary journaling file system developed by Microsoft. Starting with Windows NT 3.1, it is the default file system of the Windows NT family. It superseded File Allocation Table (FAT) as the preferred filesystem on Windows and is supported in Linux and BSD as well. NTFS reading and writing support is pro...

wary cloak
#

@old mango I think I might have found an error in the logic of the program regarding the master password, tho I would have to check it well*

wary cloak
#

I let one classmate play with the project

#

In one moment he changed the password to idk what so I said

#

Good moment to show off I have a master mode for this cases

#

But it didn't work

#

If I remember correctly before finishing to write it, it would already say incorrect password

#

My first thought is maybe because it was shorter so it didn't give me enough time to complete it

#

Ah. .

#

I know what it can be

#

So.

#

I don't remember the code like that much but

#

I think we had in a variable the length of the password entered by the user the first time

#

And we use it in the for loop for getting the user password

#

So if the password is shorter than the master password I won't get to write it

#

I guess when I tried at home they always had the same length

#

There's a lot of possible solutions, not giving freedom to the user and having the password be a fixed size (easy way out I would like to avoid it) or find a way so that master password matches regardless

#

What I'm not sure is if the problem only arises when the password is shorter

#

If is equal length it won't

#

But would it if it's longer?

#

I think maybe when we get an user password we don't set how much he can write based on the current password len

#

But rather

#

Just like create password function say, well you can type whatever but I will stop you at character 10 or you can finish earlier with "#"

#

If the code is as I remember that may fix it

wary cloak
#

@coral geyser btw I tried the offline solution

#

And got this

#
C:/Users/Taller03/Desktop/simple_bartender # cargo check --offline
error: failed to download `paste v1.0.8`

Caused by:
  unable to get packages from source

Caused by:
  failed to unpack package `paste v1.0.8`

Caused by:
  failed to unpack entry at `paste-1.0.8/.cargo_vcs_info.json`

Caused by:
  failed to unpack `D:/rust_toolchain/.cargo\registry\src\github.com-1ecc6299db9ec823\paste-1.0.8\.cargo_vcs_info.json`

Caused by:
  failed to set mtime for `D:/rust_toolchain/.cargo\registry\src\github.com-1ecc6299db9ec823\paste-1.0.8\.cargo_vcs_info.json`

Caused by:
  El parámetro no es correcto. (os error 87)
C:/Users/Taller03/Desktop/simple_bartender #
#

So yeah

#

We will have to do it the other way

#

I actually wanted to try doing it today

#

Well my road map for today would be:
1- Do the django web I have to hand in (tho if my tutor doesn't answer my question about what I have to do, I can just do the base)

2- fix the master password issue of the Arduino project

3- solve the pendrive issue ideally

4-and finally if it's a great day we could start the rfid part of the rust re writing project

#

And I have a question about the last one, Do I do git repository for it? Now that I more or less know

wary cloak
#

@old mango i tried Solving the issue on my own but I couldn't

old mango
#

Which issue?

wary cloak
wary cloak
#

Tho now

#

I can properly tell you

#

Because I tested it

#

And it was as a I thought

#

Master password works only ik the scenario

#

Where your password and the master password has the same length

#

If less it won't let you write it all and it will say beforehand is incorrect

#

If longer it won't stop when you type it and it will go on

#

I thought the solution was fairly easy

#

Mimic how you get a password in create password, until 10 characters or stop with #

#

Because rn

old mango
#

Mmhm

wary cloak
#

The for loop is until you reach password len

#

You see currently waitForPassword is like this

#
char* waitForPassword(char* user_password){
  int i;
  int password_len = EEPROM.read(254);
  for(i=0;i<password_len;i++){
    char input = keypad.waitForKey();
    user_password[i] = input;
  }
  user_password[i] = '\0';
  return user_password;
}
#

And I tried changing it to this instead

#
char* waitForPassword(char* user_password){
  int i;
  int password_len = EEPROM.read(254);
  for(i = 0; i < 10; i++){
     char input = keypad.waitForKey();
     if(input != '#'){
       user_password[i] = input;;
     } else {
       break;
     }
  user_password[i] = '\0';
  return user_password;
  }
}
#

Forgot to get rid of password len declaration

#

But ignore it

#

Strangely

#

This didn't work

#

If I remember correctly now I can like type only one character for any reason so ofc it will say is incorrect

#

What I did do was change the text of "write your current password" To give now the feedback of how it works now

#

Tho it was a bit hard because of character limitation but I guess this is enough

#
imprimir(
      { "Ingrese",  'c' },
      { "su contrase""\x01""a", 'c' },
      { "actual y finalice", 'c' },
      { "con #", 'c' }
         );
#

Anyways

#

That's the issue idk why my solution didn't work and more so why it failed like it did

old mango
#

Is waitForPassword giving the correct value?

wary cloak
#

Wdym?

#

I mean it should I only changed the for loop nothing else it returns the same thing and has the same structure

#

Only changes is that now the for loop goes until 10 or it breaks when #

#

Nothing else ao

#

So*

old mango
#

Where in the code is the failure occurring? It looks like waitforpassword is fine and I'm a bit confused by what the current issue is

wary cloak
#

Actually now that you say it

#

I didn't try in the other place where I used wait for password

#

But aside from that

#

It is wait for password

#

I go to change password

#

It ask me for my password

#

I type like one character

#

It says incorrect password

#

It doesn't let me write anything now

#

And ofc is because for any reason idk the for loop goes for only one iteration and gives back one character that obviously doesn't match with the password

#

And really the only thing that could fail in change password is wait for password that anyways didn't work before for what we needed with Master password

#

Well I say another issue

#

There's a double ";;"

#

Well double ";" I mean

#

But well I don't think that's it either

wary cloak
#

Now that I think about it, it's strange that it didn't warn me about the ";;" Considering how C++ cries to me for the smallest thing

old mango
#

Ohhh i see what the issue is

#

Read over that function again, and tell me where the for loop ends

#

@wary cloak

old mango
#

Which is just saying "while serial is unavailable, continuously do this <empty statement>"

wary cloak
#

Oh

wary cloak
#

Oh

#

The return is in the for loop I need an extra bracket

#

Well I have to go to sleep for today but tomorrow I will try that and hopefully that solves the issue and that would be it for now

#

Tomorrow I tell you "it worked" Or "this happened"

wary cloak
#

@coral geyser think you'll be tonight to make the pendrive thingy?

wary cloak
#

It worked

#

I also had to change some other things but messages only it's perfect now

#

Now the project has a technical issue not a code issue so I will have to wait

#

Tho

#

The ultrasonic sensors code is kinda some more or less

#

Now I maybe will start the other the one with the SIM and stuff

#

Ideally I won't need help until reaching the final part with the SIM module

#

Because that's new, tho maaaaybe if I could figure it out on my own would be cool

#

In any case I'll be asking

wary cloak
#

I will need help I'm installing this abstraction on a new pc and got stuck here

#

I had already re installed rust and followed the instructions up until that point

#

but for any reason