Moving code from ESP8266 to ESP32

A while ago I made a mashup of Dan Royer's code CNC 2 Axis Demo with my own code for trapezoidal motion stepper and servo control for ESP8266.

I assumed porting the code to the ESP32 would be trivial, and that was true for the most part: changes like library name being Wifi.h instead of Wifi8266.h were not a problem. UDP now does not like multicharacter writes but you can use print instead. So far so good.

However, when it came to the interrupt code I was stuck with the stepper interrupt causing an exception sometimes. And to make things weirder, the servo interrupt worked flawlessly (both of them had the IRAM_ATTR directive if you ask me).

Going little by little, I could narrow down the culprit to a floating point operation during the interrupt, that would cause problems sometimes but not always. Browsing around I found this post. Where the solution was simple: do not use floats within the interrupt routines but doubles. The reason was the float calculation would be performed by…


Today, after a long wait, I made my mind to shopping for a brand-new MacBook Air. I went to the Apple store in my city before the summer but I did not like what I was told: They will make me a nice discount for being a university professor but only if I was billed personally. I wanted the machine to be invoiced to my university that would slash the discount seriously. It did not matter that my university was a leading public university in the country. I left the shop shocked and empty handed.

After checking with some colleagues it seems that is Apple's usual policy, though nobody was able to explain why. Anyway, after doing some taxes math I saw it was still more convenient for me to charge the bill to my personal expenses account I hold with my employer so I went for it.

These is more or less my experience today at the Apple Store in Valencia.

Apple rep1 (at the door): How can we help you today Sir?
Me: I would like to buy a MacBook Air.
Apple rep1: Do you have it reserved?
Me: No, I don't. But I do know the model I want. Do you mean I need to make a reservation for a unit?
Apple rep1: No Sir. I did not say you need to book a unit in advance.
Me: I just heard you asking me if I have it reserved ... (odd awkward moment)

Apple rep1: Please come with me so my colleague will handle your order. (We are guided to the MacBook Pro 15" area and we are told to wait there for the representative that will help us next, and so we do).

Apple rep2: (After asking as our names) What can I do for you?
Me: I want to bay an i7 MacBook Air with 8GB of RAM and 512 GB of storage. I want the order to be invoiced to my [employer who is a local] university.
Apple rep2: We'll let me check if we can do that, as the university counter should come here for such an order with the tax number.
(After a while he is back and confirms we can proceed) But now the discount will be much lower than if you were buying the unit personally.
Me: I acknowledge that but insist I want the invoice to be to the name of my university:
Apple rep2: Unfortunately my colleagues that handle business accounts are already off and I am afraid I won't be able to get your university taxes number. Do you have it by any chance?
Me: Of course I have it, it is ******.
Apple rep2: Ah, ok then. Please give company name and address. Would you pay credit card or cash?
Me: I would pay credit card.
Apple rep2: Ok, hold down and I'll be right back.
... one minute or two later ...
Apple rep3: Congratulations on your new MacBook Air. Now my colleague will proceed with the billing.
(Some conversation about the university takes place now, as Apple rep2 is a graduate from my university but I do not think that is relevant to this post).
Apple rep3: These are the details of the transaction (and repeats all my company data). Is that ok?
(he has been frantically using the inch-thick iphone-based device they use as a terminal for a while and eventually produces a ticket which hands over to me).
Me: What is the invoice number? (nothing like invoice number text appears on the ticket).
Apple rep2: (pointing at a barcode) That is it.
Me: Ok thank you very much.
Apple rep2: Would you like to configure your new laptop in the shop?
Me: No, thanks, I will do that at home.
We both say good-bye and I leave the shop with my laptop in a bag.

I really did not like the feeling in the shop. It felt like unless you make clear you know nothing about computers and they do not know how to handle you. I do own several Apple computers I have bought over the years though I am not an Apple fanboy. I think next time I am buying an Apple computer I will buy it online as half of my interactions with the shop representatives were kind of telling me that buying might not be possible at all. I am not asking for pushy salesman but a bit of a profesional salesman would help, even if they are not in their twenties but know the ropes.

As for the Air, what can I say? It is a light but powerful beautiful machine.


Popular posts from this blog

VFD control with Arduino using RS485 link

4xiDraw: Another pen plotter

Software I2C for Arduino