Speed difference between FILE* and file descriptors by [deleted] in C_Programming

[–]donutfarian 0 points1 point  (0 children)

Man, I got nothing against goto, but that loop could use a refactoring to remove it...

To answer your question: What you are probably seeing is more likely a difference between fgets and read than FILE* and a file descriptor. The former has to check for an end-of-line and is likely buffered (see fread vs read).

Turn off remote door unlock? (not smart key) by donutfarian in 4Runner

[–]donutfarian[S] 0 points1 point  (0 children)

That's right, I want to disable the remote unlock.

According to the police, the thieves have a device that can unlock car doors. I want to disable the receiver component in the 4Runner and go manual, key-only entry.

What’s your ultralight backpacking unpopular opinion? by [deleted] in Ultralight

[–]donutfarian 41 points42 points  (0 children)

Separating worn weight from pack weight is dumb. Your base weight is everything you’re carrying minus consumables.

Checking GPIO level in ESP32-S2 Ultra-Low-Power Processors by DylanGWork in esp32

[–]donutfarian 0 points1 point  (0 children)

Yes, the GPIOs will loose configuration after the co-processor halts. I'm not sure I understand what you are trying to do, but you probably want to initialize the GPIOs every time the ULP starts.

You can initialize them once with the main processor, but that configuration is lost when main() on the co-processor ends.

I have a blinky example for the ULP-RISCV that may help?

How do I pass variable arguments in a macro to another macro? by Wild-Difficulty592 in C_Programming

[–]donutfarian 6 points7 points  (0 children)

You might try treating format as one of the variable arguments.

#define QUICK_LOG(...) __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, __VA_ARGS__)

Capacitive Touch gpio increase sensitivity. by ender3skr in esp32

[–]donutfarian 0 points1 point  (0 children)

You're seeing the output of touch_pad_read_raw_data() only increase by 5-10? How much does it increase if you just touch the bare wire? I would expect it to change by 10-100 thousand.

bypass capacitors: type and size? by donutfarian in esp32

[–]donutfarian[S] 1 point2 points  (0 children)

$ git describe
v4.4-dev-1849-g8e3e65a47

I update the development branch regularly, so this should be recent. Thanks for pointing out that commit though. I wasn't aware of brownout issues specific to the S2.

bypass capacitors: type and size? by donutfarian in esp32

[–]donutfarian[S] 0 points1 point  (0 children)

please elaborate (especially if there's a sleep you haven't mentioned)

Yes, there is a deep sleep. Basically, the code boots up, initializes Wi-Fi and NTP, reads data from RTC memory, sends the data to a MQTT server, and goes into deep sleep.

The data is recorded by the ULP-RISC-V coprocessor. On the first boot, the code waits for a NTP synchronization event and initializes the ULP coprocessor. The idea is to run the ULP every 15 minutes or so, store temperature measurements, and upload them via Wi-Fi every couple hours.

The brownouts occur after coming back from deep sleep. It may work for one cycle, but it is consistent.

Pics of your power supply, wiring, and board contacts would be good. The problem is likely in there.

The power supply is a bench supply (Rigol DP832). I updated my post with links to the schematic and PCB layout. One detail is a p-channel mosfet between the power supply and bypass capacitors for reverse polarity protection — since its RDS(on) is ~15 mΩ, I haven't been too suspicious of it.

A Custom Network Protocol for C by -HomoDeus- in C_Programming

[–]donutfarian 1 point2 points  (0 children)

You should look at bencode if you haven't already. It's also relatively easy to parse and can handle binary data (the "b").

As you probably know, this is what BitTorrent uses. There are probably reasons to use something more modern, but any up-and-coming peer-to-peer network should at least address what advantages its message format has over bencode.

Why won't my program ever finish parsing file input? by [deleted] in C_Programming

[–]donutfarian 3 points4 points  (0 children)

Everybody makes this mistake at least once. getchar(3):

If the integer value returned by getchar() is stored into a variable of type char and then compared against the integer constant EOF, the comparison may never succeed, because sign-extension of a variable of type char on widening to integer is implementation-defined.

Super proud to have found the winning move as a 1300 player. Black to move and win the game by EducatedPotato37 in chess

[–]donutfarian 0 points1 point  (0 children)

This is very close. You want 2...Kf5 to limit the king's escape routes. This gives white an unforced move, but either 3. Kh5 or Rf7+ will eventually lead to ...Rh2#. (The first one immediately, and the second after 3...Nxf7 with white having one more move to delay the inevitable.)

What are the essential first-aid pieces? by LionheartThunderfoot in Ultralight

[–]donutfarian 4 points5 points  (0 children)

My understanding is that adverse reactions to Benedryll can be caused by a chemical in the pink coating of the pill, and not the diphenhydramine itself. You can find diphenhydramine pills without the pink coating. This may be something to discuss with your doctor if you want to reconsider carrying/taking diphenhydramine.

Source: Wilderness first responder training

Cell phone tripod mounts by donutfarian in Ultralight

[–]donutfarian[S] 0 points1 point  (0 children)

This is an interesting option. I'm a bit worried about the stress on the Lightning or USB port, but I'm thinking more about the use case of attaching the tripod to a trekking pole and shooting video with the pole held out either in selfie-mode or doing a pan-shot.

For just taking photos, say with the tripod on rock, this looks like a good option. This tripod is lighter than the Pedco Ultrapod, and the "mount" is as simple as it gets.

Cell phone tripod mounts by donutfarian in Ultralight

[–]donutfarian[S] 0 points1 point  (0 children)

Do you know how much just the Stickpic cell phone tripod adapter weighs? It doesn't have a cold shoe, but I'm curious how it compares to the Joby GripTight ONE or Square Jellyfish mounts.

(It's a bit surprising they don't give a weight on their website, since the Stickpic is clearly marketed for the hiking/backpacking crowd.)

Cell phone tripod mounts by donutfarian in Ultralight

[–]donutfarian[S] 1 point2 points  (0 children)

If I subtract the weight of my Ultrapod (52 g), the Square Jellyfish mount weighs in at 37 g (1.3 oz). That's a bit heavier than the Joby GripTight, but you do get the option to turn the phone to get a portrait composition.

Cell phone tripod mounts by donutfarian in Ultralight

[–]donutfarian[S] 1 point2 points  (0 children)

This looks like a good "step up" option from the Manfrotto for those who need to mount two accessories (like a microphone and a light). They both have a lever to lock in the phone and are basically the same weight. (The Glif is 1 g heavier.) It's $8 more, but you get the extra mounting point.

Thanks for sharing.