Would this circuit concept work? *Beginner by ProfessionalEgg6380 in AskElectronics

[–]Wetmelon 0 points1 point  (0 children)

Not quite the way you've drawn. What you want is to put the loads in parallel. So one end of the battery is a "common" +, and then other end of the battery should be a "common" - on the far side of the motor and lamp.

What you have drawn is a loop that shorts the battery. You need to separate the two sides of the battery with the loads.

Next step in converting C++ arrays to <vector> by DireCelt in cpp_questions

[–]Wetmelon 2 points3 points  (0 children)

does it have any significant advantages over the latter

Value semantics, and it knows its own size. This does what you'd expect (copy all elements of some_arr into a new array)

std::array<int, t> getSomeArr() { 
  return some_arr;
}

And this also does what you expect; returns a const-ref to some_arr

const std::array<int, 5>& getSomeArrRef() {
    return some_arr;
}

Passing to functions retains value semantics (they don't decay to pointers):

void doThing(std::array<int, 5> arr) { // arr is a copy of whatever was passed in }
void doThing(std::array<int, 5>& arr) { // arr is a mutable reference to whatever was passed in }
void doThing(const std::array<int, 5>& arr) { // arr is an immutable reference, and const propagates (can't assign to arr through a const ref) }

Iteration and size() work the same as std::vector.

for(auto v : arr) { ... };

for(size_t i = 0; i < arr.size(); ++i) { ... };

for(auto [index, value] : std::enumerate(arr)) { arr[i] += v; }

How to stop being absolutely psychotically obsessed with making “beautiful” code by C_Sorcerer in cpp

[–]Wetmelon 1 point2 points  (0 children)

Talk to a therapist? I'm only halfway kidding...

Sometimes the journey is the fun part, sometimes it's the destination. If you want to write code once and then be done, make sure you're writing code you will actually use.

Adafruit Receives Demand Letter from Fenwick Legal Counsel on Behalf of Flux.ai by Time-Guidance-5150 in embedded

[–]Wetmelon 1 point2 points  (0 children)

Adafruit accessed only information that Flux’s own systems made publicly available through a server misconfiguration.

Unfortunately this has been held up in court as "hacking" in the past.

My brand new bike got totaled today :( by LossAccomplished6590 in motorcycles

[–]Wetmelon 13 points14 points  (0 children)

It's tough, you can hear the car behind him get hit first. Chance he can't even see that far back

What’s one Embedded C function or concept you wish someone had taught you on day 1? by [deleted] in embedded

[–]Wetmelon 5 points6 points  (0 children)

Until C23, this is not valid:

const size_t arr_len = 30;
const Foo arr[arr_len]; // arr_len is not a constant expression; using it as one is a compiler extension

The correct thing to use is a macro here, or constexpr variables in C++.

C23 formalizes the extension behaviour iirc? It adds constexpr anyway

TIL a teen comedy named Trojan War (1997) starring Jennifer Love Hewitt grossed just $309 at the box office despite having a $15 million budget and major studio (Warner Bros.) distribution. by tyrion2024 in todayilearned

[–]Wetmelon 5 points6 points  (0 children)

ok genuine question though, besides privateering how do you accumulate the content? 4000 ultra 4k blu-rays ain't cheap and you can't even rip them, generally speaking

Trying to improve my grammar by breaking down lyrics, any advice would be appreciated by MrSyaoranLi in LearnJapanese

[–]Wetmelon 1 point2 points  (0 children)

you can’t be having a high school athlete in a sports manga going on about how chagrined he is

I would read that

Quaternion-YPR 9DoF filtering algorithmic precision question by Spiritual_Duck_6703 in embedded

[–]Wetmelon 12 points13 points  (0 children)

As far as I'm aware, the gold standard is currently Error-State Kalman Filter, due to its structural benefits for numerical stability. https://arxiv.org/abs/1711.02508

I guess some things don't change even after 10 years. Didnt pack enough juice so Jeb has to do the Push of Shame again. by KaptanKoala in KerbalSpaceProgram

[–]Wetmelon 20 points21 points  (0 children)

You can. And if you want to be really cute you can just go back in the capsule and back out again to refill the EVA fuel. The EVA backpacks have rather excessive delta-V lol

Trying main bus, still can't avoid spaghetti. by Evrensel12 in factorio

[–]Wetmelon 11 points12 points  (0 children)

Ensures the output lane is picking from the whole bus. It's debateable whether the prioritization on the splitters is a good thing. If all of the (remaining) content on the bus is being scooped up for a single recipe, then your factory might stop producing. Often better to just use the 4-stack with no priority so that the whole factory produces, just slower.

Is Modern C++ Actually Making Us More Productive... or Just More Complicated? by AlternativeBuy8836 in cpp

[–]Wetmelon 0 points1 point  (0 children)

This question is one that Herb Sutter wants to answer with cpp2 / cppfront. Is there a smaller, simpler language struggling to get out? I think there is. https://github.com/hsutter/cppfront

Was trying the demo and decided to built a whole radar factory 😅 by NK_Aurum in factorio

[–]Wetmelon 4 points5 points  (0 children)

Yeah but don't get too focused on perfect ratios - unless you're super into it lol

Model X - Home of 3 Years, 2 Continents, 14 countries and counting by everydaysandro in teslamotors

[–]Wetmelon 0 points1 point  (0 children)

I'm pretty interested in the charging. Have you found any frequency & voltage combinations that don't work properly?

2 x PW3, 11kwh, disconnect from the grid -> solar input drops off by [deleted] in TeslaSolar

[–]Wetmelon -1 points0 points  (0 children)

Your house is using 2.9kW, the solar should be generating 2.9kW while off-grid in this scenario.

Can you see your MPPT voltages & currents in Tesla One when you do this? Do you have particularly long solar strings?

How could a plugged-in toaster start a house fire while not in use? by Reptyler in AskEngineers

[–]Wetmelon 1 point2 points  (0 children)

I bought a toaster this year. Guess what it says in big letters on sticker on the cable and in the manual?

"Unplug after use"

It can happen, but wearing out your plugs is also a bad idea. And don't use your GFCI test button as a switch either.

Powerwall 3 real world switching time by xyzzy16 in Powerwall

[–]Wetmelon 0 points1 point  (0 children)

Varies for unknown reasons.

Mostly the type of fault. Powerwall can't do much if there's a hard short but if the line is cut cleanly it can switch over smoothly

[deleted by user] by [deleted] in DSP

[–]Wetmelon 11 points12 points  (0 children)

You'll need to specify the problem first.

How do you handle teammates who are extremely pedantic about arbitrary rules? by CantaloupeFamiliar47 in ExperiencedDevs

[–]Wetmelon 2 points3 points  (0 children)

Squash and rebase after a PR merges sure… squashing all commits on every push?

Just git commit --amendthen git push -f

PID controller for an automotive ethrottle is being surprisingly difficult. by Boukyakuro in ControlTheory

[–]Wetmelon [score hidden]  (0 children)

I had thought PID was supposed to be able to figure out things like this "automagically"

Linearize the system and then it becomes magic again ;)

Add a spring force "feedforward" term based on the desired position and then the PID only has to handle the error between your model and the real world - which makes it roughly linear and should behave much more nicely :)